<commit_before>// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

import { asyncRouterMap, constantRouterMap } from '@/config/router'

function hasApi (apis, route) {
  if (route.meta && route.meta.permission) {
    for (const permission of route.meta.permission) {
      if (!apis.includes(permission)) {
        return false
      }
    }
  }
  return true
}

function filterAsyncRouter (routerMap, apis) {
  const accessedRouters = routerMap.filter(route => {
    if (hasApi(apis, route)) {
      if (route.children && route.children.length > 0) {
        route.children = filterAsyncRouter(route.children, apis)
      }
      return true
    }
    return false
  })
  return accessedRouters
}

const permission = {
  state: {
    routers: constantRouterMap,
    addRouters: []
  },
  mutations: {
    SET_ROUTERS: (state, routers) => {
      state.addRouters = routers
      state.routers = constantRouterMap.concat(routers)
    }
  },
  actions: {
    GenerateRoutes ({ commit }, data) {
      return new Promise(resolve => {
        const apis = Object.keys(data.apis)
        const accessedRouters = filterAsyncRouter(asyncRouterMap, apis)
        commit('SET_ROUTERS', accessedRouters)
        resolve()
      })
    }
  }
}

export default permission
<commit_msg>permission: allow permissive routes<commit_after>// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

import { asyncRouterMap, constantRouterMap } from '@/config/router'

function hasApi (apis, route) {
  if (route.meta && route.meta.permission) {
    for (const permission of route.meta.permission) {
      if (apis.includes(permission)) {
        return true
      }
    }
    return false
  }
  return true
}

function filterAsyncRouter (routerMap, apis) {
  const accessedRouters = routerMap.filter(route => {
    if (hasApi(apis, route)) {
      if (route.children && route.children.length > 0) {
        route.children = filterAsyncRouter(route.children, apis)
      }
      return true
    }
    return false
  })
  return accessedRouters
}

const permission = {
  state: {
    routers: constantRouterMap,
    addRouters: []
  },
  mutations: {
    SET_ROUTERS: (state, routers) => {
      state.addRouters = routers
      state.routers = constantRouterMap.concat(routers)
    }
  },
  actions: {
    GenerateRoutes ({ commit }, data) {
      return new Promise(resolve => {
        const apis = Object.keys(data.apis)
        const accessedRouters = filterAsyncRouter(asyncRouterMap, apis)
        commit('SET_ROUTERS', accessedRouters)
        resolve()
      })
    }
  }
}

export default permission
<|endoftext|>


<commit_before>/*
 * (c) Copyright Ascensio System SIA 2010-2019
 *
 * This program is a free software product. You can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License (AGPL)
 * version 3 as published by the Free Software Foundation. In accordance with
 * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
 * that Ascensio System SIA expressly excludes the warranty of non-infringement
 * of any third-party rights.
 *
 * This program is distributed WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR  PURPOSE. For
 * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
 *
 * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
 * street, Riga, Latvia, EU, LV-1050.
 *
 * The  interactive user interfaces in modified source and object code versions
 * of the Program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU AGPL version 3.
 *
 * Pursuant to Section 7(b) of the License you must retain the original Product
 * logo when distributing the program. Pursuant to Section 7(e) we decline to
 * grant you any rights under trademark law for use of our trademarks.
 *
 * All the Product's GUI elements, including illustrations and icon sets, as
 * well as technical writing content are licensed under the terms of the
 * Creative Commons Attribution-ShareAlike 4.0 International. See the License
 * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
 *
 */

$(function () {

	Asc.spreadsheet_api.prototype._init = function () {
	};
	Asc.spreadsheet_api.prototype._loadFonts = function (fonts, callback) {
		callback();
	};
	AscCommonExcel.WorkbookView.prototype._calcMaxDigitWidth = function () {
	};
	AscCommonExcel.WorkbookView.prototype._init = function () {
	};
	AscCommonExcel.WorkbookView.prototype._onWSSelectionChanged = function () {
	};
	AscCommonExcel.WorkbookView.prototype.showWorksheet = function () {
	};
	AscCommonExcel.WorksheetView.prototype._init = function () {
	};
	AscCommonExcel.WorksheetView.prototype._onUpdateFormatTable = function () {
	};
	AscCommonExcel.WorksheetView.prototype.setSelection = function () {
	};
	AscCommonExcel.WorksheetView.prototype.draw = function () {
	};
	AscCommonExcel.WorksheetView.prototype._prepareDrawingObjects = function () {
	};
	AscCommonExcel.WorksheetView.prototype._reinitializeScroll = function () {
	};
	AscCommonExcel.WorksheetView.prototype.getZoom = function () {
	};
	AscCommon.baseEditorsApi.prototype._onEndLoadSdk = function () {
	};

	var sData = AscCommon.getEmpty();
	var api = new Asc.spreadsheet_api({
		'id-view': 'editor_sdk'
	});
	window["Asc"]["editor"] = api;
	AscCommon.g_oTableId.init();
	api._onEndLoadSdk();
	api._openDocument(sData);
	api._openOnClient();
	api.collaborativeEditing = new AscCommonExcel.CCollaborativeEditing({});
	api.wb = new AscCommonExcel.WorkbookView(api.wbModel, api.controller, api.handlers, api.HtmlElement,
		api.topLineEditorElement, api, api.collaborativeEditing, api.fontRenderingMode);
	var wb = api.wbModel;
	wb.handlers.add("getSelectionState", function () {
		return null;
	});
	wb.handlers.add("getLockDefNameManagerStatus", function () {
		return true;
	});
	api.wb.cellCommentator = new AscCommonExcel.CCellCommentator({
		model: api.wbModel.aWorksheets[0],
		collaborativeEditing: null,
		draw: function() {
		},
		handlers: {
			trigger: function() {
				return false;
			}
		}
	});

	AscCommonExcel.CCellCommentator.prototype.isLockedComment = function (oComment, callbackFunc) {
		callbackFunc(true);
	};
	AscCommonExcel.CCellCommentator.prototype.drawCommentCells = function () {
	};
	AscCommonExcel.CCellCommentator.prototype.ascCvtRatio = function () {
	};

	var wsView = api.wb.getWorksheet(0);
	wsView.handlers = api.handlers;
	wsView.objectRender = new AscFormat.DrawingObjects();
	var ws = api.wbModel.aWorksheets[0];

	var getRange = function (c1, r1, c2, r2) {
		return new window["Asc"].Range(c1, r1, c2, r2);
	};

	test("Test: \"simple tests\"", function () {

		ws.getRange2("A1").setValue("-4");

		ws.selectionRange.ranges = [getRange(0, 0, 0, 0)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValue(), ws.getRange2("A1").getValue());

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValue(), "-4");
		strictEqual(ws.getRange2("B6").getValue(), "-4");
		strictEqual(ws.getRange2("B7").getValue(), "-4");
		strictEqual(ws.getRange2("B8").getValue(), "-4");
		strictEqual(ws.getRange2("B9").getValue(), "-4");
	});

	test("Test: \"formula tests\"", function () {
		var val = "=SIN(1)";

		ws.getRange2("A1").setValue(val);

		ws.selectionRange.ranges = [getRange(0, 0, 0, 0)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValueForEdit(), ws.getRange2("A1").getValueForEdit());

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValueForEdit(), val);
		strictEqual(ws.getRange2("B6").getValueForEdit(), val);
		strictEqual(ws.getRange2("B7").getValueForEdit(), val);
		strictEqual(ws.getRange2("B8").getValueForEdit(), val);
		strictEqual(ws.getRange2("B9").getValueForEdit(), val);

		var val1 = "=SIN(A2)";
		var val2 = "=SIN(A3)";

		ws.getRange2("A1").setValue(val1);
		ws.getRange2("A2").setValue(val2);

		ws.selectionRange.ranges = [getRange(0, 0, 0, 1)];
		base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(2, 1, 2, 6), getRange(3, 5, 3, 8), getRange(4, 5, 4, 7)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("C2").getValueForEdit(), "=SIN(C3)");
		strictEqual(ws.getRange2("C3").getValueForEdit(), "=SIN(C4)");
		strictEqual(ws.getRange2("C4").getValueForEdit(), "=SIN(C5)");
		strictEqual(ws.getRange2("C5").getValueForEdit(), "=SIN(C6)");
		strictEqual(ws.getRange2("C6").getValueForEdit(), "=SIN(C7)");
		strictEqual(ws.getRange2("C7").getValueForEdit(), "=SIN(C8)");

		strictEqual(ws.getRange2("D6").getValueForEdit(), "=SIN(D7)");
		strictEqual(ws.getRange2("D7").getValueForEdit(), "=SIN(D8)");
		strictEqual(ws.getRange2("D8").getValueForEdit(), "=SIN(D9)");
		strictEqual(ws.getRange2("D9").getValueForEdit(), "=SIN(D10)");

		strictEqual(ws.getRange2("E6").getValueForEdit(), "=SIN(E7)");
		strictEqual(ws.getRange2("E7").getValueForEdit(), "=SIN(E8)");
		strictEqual(ws.getRange2("E8").getValueForEdit(), "");
	});

	test("Test: \"comment tests\"", function () {

		ws.getRange2("E10").setValue("-4");
		var comment = new  window["Asc"].asc_CCommentData(null);
		comment.asc_putText("test");
		comment.bDocument = false;
		/*comment.asc_putTime(this.utcDateToString(new Date()));
		comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
		comment.asc_putUserId(this.currentUserId);
		comment.asc_putUserName(this.currentUserName);
		comment.asc_putSolved(false);*/
		api.asc_addComment(comment);
		comment.nCol = 4;
		comment.nRow = 9;

		ws.selectionRange.ranges = [getRange(4, 9, 4, 9)];

		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValue(), ws.getRange2("E10").getValue());
		strictEqual(wsView.cellCommentator.getComment(4,9).nCol, 4);

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValue(), "-4");
		strictEqual(ws.getRange2("B6").getValue(), "-4");
		strictEqual(ws.getRange2("B7").getValue(), "-4");
		strictEqual(ws.getRange2("B8").getValue(), "-4");
		strictEqual(ws.getRange2("B9").getValue(), "-4");
	});

	test("Test: \"tables\"", function () {
		ws.autoFilters.addAutoFilter("TableStyleMedium2", getRange(3, 5, 3, 8));

		ws.selectionRange.ranges = [getRange(3, 5, 3, 9)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(4, 10, 4, 10)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.c1, 4);

		ws.selectionRange.ranges = [getRange(5, 10, 5, 10), getRange(6, 10, 6, 10)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.TableParts[ws.TableParts.length - 2].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 2].Ref.c1, 5);

		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.c1, 6)
	});

	module("CopyPaste");
});<commit_msg>[se] By previos<commit_after>/*
 * (c) Copyright Ascensio System SIA 2010-2019
 *
 * This program is a free software product. You can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License (AGPL)
 * version 3 as published by the Free Software Foundation. In accordance with
 * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
 * that Ascensio System SIA expressly excludes the warranty of non-infringement
 * of any third-party rights.
 *
 * This program is distributed WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR  PURPOSE. For
 * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
 *
 * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
 * street, Riga, Latvia, EU, LV-1050.
 *
 * The  interactive user interfaces in modified source and object code versions
 * of the Program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU AGPL version 3.
 *
 * Pursuant to Section 7(b) of the License you must retain the original Product
 * logo when distributing the program. Pursuant to Section 7(e) we decline to
 * grant you any rights under trademark law for use of our trademarks.
 *
 * All the Product's GUI elements, including illustrations and icon sets, as
 * well as technical writing content are licensed under the terms of the
 * Creative Commons Attribution-ShareAlike 4.0 International. See the License
 * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
 *
 */

$(function () {

	Asc.spreadsheet_api.prototype._init = function () {
	};
	Asc.spreadsheet_api.prototype._loadFonts = function (fonts, callback) {
		callback();
	};
	AscCommonExcel.WorkbookView.prototype._calcMaxDigitWidth = function () {
	};
	AscCommonExcel.WorkbookView.prototype._init = function () {
	};
	AscCommonExcel.WorkbookView.prototype._onWSSelectionChanged = function () {
	};
	AscCommonExcel.WorkbookView.prototype.showWorksheet = function () {
	};
	AscCommonExcel.WorksheetView.prototype._init = function () {
	};
	AscCommonExcel.WorksheetView.prototype._onUpdateFormatTable = function () {
	};
	AscCommonExcel.WorksheetView.prototype.setSelection = function () {
	};
	AscCommonExcel.WorksheetView.prototype.draw = function () {
	};
	AscCommonExcel.WorksheetView.prototype._prepareDrawingObjects = function () {
	};
	AscCommonExcel.WorksheetView.prototype._reinitializeScroll = function () {
	};
	AscCommonExcel.WorksheetView.prototype.getZoom = function () {
	};
	AscCommon.baseEditorsApi.prototype._onEndLoadSdk = function () {
	};

	var sData = AscCommon.getEmpty();
	var api = new Asc.spreadsheet_api({
		'id-view': 'editor_sdk'
	});
	window["Asc"]["editor"] = api;
	AscCommon.g_oTableId.init();
	api._onEndLoadSdk();
	api._openDocument(sData);
	api._openOnClient();
	api.collaborativeEditing = new AscCommonExcel.CCollaborativeEditing({});
	api.wb = new AscCommonExcel.WorkbookView(api.wbModel, api.controller, api.handlers, api.HtmlElement,
		api.topLineEditorElement, api, api.collaborativeEditing, api.fontRenderingMode);
	var wb = api.wbModel;
	wb.handlers.add("getSelectionState", function () {
		return null;
	});
	wb.handlers.add("getLockDefNameManagerStatus", function () {
		return true;
	});
	api.wb.cellCommentator = new AscCommonExcel.CCellCommentator({
		model: api.wbModel.aWorksheets[0],
		collaborativeEditing: null,
		draw: function() {
		},
		handlers: {
			trigger: function() {
				return false;
			}
		}
	});

	AscCommonExcel.CCellCommentator.prototype.isLockedComment = function (oComment, callbackFunc) {
		callbackFunc(true);
	};
	AscCommonExcel.CCellCommentator.prototype.drawCommentCells = function () {
	};
	AscCommonExcel.CCellCommentator.prototype.ascCvtRatio = function () {
	};

	var wsView = api.wb.getWorksheet(0);
	wsView.handlers = api.handlers;
	wsView.objectRender = new AscFormat.DrawingObjects();
	var ws = api.wbModel.aWorksheets[0];

	var getRange = function (c1, r1, c2, r2) {
		return new window["Asc"].Range(c1, r1, c2, r2);
	};

	test("Test: \"simple tests\"", function () {

		ws.getRange2("A1").setValue("-4");

		ws.selectionRange.ranges = [getRange(0, 0, 0, 0)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValue(), ws.getRange2("A1").getValue());

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValue(), "-4");
		strictEqual(ws.getRange2("B6").getValue(), "-4");
		strictEqual(ws.getRange2("B7").getValue(), "-4");
		strictEqual(ws.getRange2("B8").getValue(), "-4");
		strictEqual(ws.getRange2("B9").getValue(), "-4");
	});

	test("Test: \"formula tests\"", function () {
		var val = "=SIN(1)";

		ws.getRange2("A1").setValue(val);

		ws.selectionRange.ranges = [getRange(0, 0, 0, 0)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValueForEdit(), ws.getRange2("A1").getValueForEdit());

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValueForEdit(), val);
		strictEqual(ws.getRange2("B6").getValueForEdit(), val);
		strictEqual(ws.getRange2("B7").getValueForEdit(), val);
		strictEqual(ws.getRange2("B8").getValueForEdit(), val);
		strictEqual(ws.getRange2("B9").getValueForEdit(), val);

		var val1 = "=SIN(A2)";
		var val2 = "=SIN(A3)";

		ws.getRange2("A1").setValue(val1);
		ws.getRange2("A2").setValue(val2);

		ws.selectionRange.ranges = [getRange(0, 0, 0, 1)];
		base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(2, 1, 2, 6), getRange(3, 5, 3, 8), getRange(4, 5, 4, 7)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("C2").getValueForEdit(), "=SIN(C3)");
		strictEqual(ws.getRange2("C3").getValueForEdit(), "=SIN(C4)");
		strictEqual(ws.getRange2("C4").getValueForEdit(), "=SIN(C5)");
		strictEqual(ws.getRange2("C5").getValueForEdit(), "=SIN(C6)");
		strictEqual(ws.getRange2("C6").getValueForEdit(), "=SIN(C7)");
		strictEqual(ws.getRange2("C7").getValueForEdit(), "=SIN(C8)");

		strictEqual(ws.getRange2("D6").getValueForEdit(), "=SIN(D7)");
		strictEqual(ws.getRange2("D7").getValueForEdit(), "=SIN(D8)");
		strictEqual(ws.getRange2("D8").getValueForEdit(), "=SIN(D9)");
		strictEqual(ws.getRange2("D9").getValueForEdit(), "=SIN(D10)");

		strictEqual(ws.getRange2("E6").getValueForEdit(), "=SIN(E7)");
		strictEqual(ws.getRange2("E7").getValueForEdit(), "=SIN(E8)");
		strictEqual(ws.getRange2("E8").getValueForEdit(), "");
	});

	test("Test: \"comment tests\"", function () {

		ws.getRange2("E10").setValue("-4");
		var comment = new  window["Asc"].asc_CCommentData(null);
		comment.asc_putText("test");
		comment.bDocument = false;
		/*comment.asc_putTime(this.utcDateToString(new Date()));
		comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
		comment.asc_putUserId(this.currentUserId);
		comment.asc_putUserName(this.currentUserName);
		comment.asc_putSolved(false);*/
		api.asc_addComment(comment);
		comment.nCol = 4;
		comment.nRow = 9;
		comment.coords.nCol = 4;
		comment.coords.nRow = 9;

		ws.selectionRange.ranges = [getRange(4, 9, 4, 9)];

		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(0, 1, 0, 1)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A2").getValue(), ws.getRange2("E10").getValue());
		strictEqual(wsView.cellCommentator.getComment(4,9).nCol, 4);

		ws.selectionRange.ranges = [getRange(0, 5, 0, 5), getRange(1, 5, 1, 8)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.getRange2("A6").getValue(), "-4");
		strictEqual(ws.getRange2("B6").getValue(), "-4");
		strictEqual(ws.getRange2("B7").getValue(), "-4");
		strictEqual(ws.getRange2("B8").getValue(), "-4");
		strictEqual(ws.getRange2("B9").getValue(), "-4");

		strictEqual(wsView.cellCommentator.getComment(0,5).nRow, 5);
		strictEqual(wsView.cellCommentator.getComment(1,5).nRow, 5);
		strictEqual(wsView.cellCommentator.getComment(1,6).nRow, 6);
		strictEqual(wsView.cellCommentator.getComment(1,7).nRow, 7);
		strictEqual(wsView.cellCommentator.getComment(1,8).nRow, 8);

		strictEqual(wsView.cellCommentator.getComment(1,9), null);
	});

	test("Test: \"tables\"", function () {
		ws.autoFilters.addAutoFilter("TableStyleMedium2", getRange(3, 5, 3, 8));

		ws.selectionRange.ranges = [getRange(3, 5, 3, 9)];
		var base64 = AscCommonExcel.g_clipboardExcel.copyProcessor.getBinaryForCopy(ws, wsView.objectRender);

		ws.selectionRange.ranges = [getRange(4, 10, 4, 10)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.c1, 4);

		ws.selectionRange.ranges = [getRange(5, 10, 5, 10), getRange(6, 10, 6, 10)];
		AscCommonExcel.g_clipboardExcel.pasteData(wsView, AscCommon.c_oAscClipboardDataFormat.Internal, base64);

		strictEqual(ws.TableParts[ws.TableParts.length - 2].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 2].Ref.c1, 5);

		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.r1, 10);
		strictEqual(ws.TableParts[ws.TableParts.length - 1].Ref.c1, 6)
	});

	module("CopyPaste");
});<|endoftext|>


<commit_before>INTERVAL = 0;
BLOB_SIZE = 10;
BLOB_DRAW_INTERVAL = 50;
SCALEFACTOR = 1.0;
BACKGROUND_COLOR = "#1D1D1D";

/* Libraries used
jQuery: http://jquery.com/ */
var map = new Image();
map.src = "./img/map.png";
var blobs = [];
var clicked = false;

/* Fit the canvas properly inside the window
1000 * 550 are the "baseline" dimensions */
function doResize()
{
	var canvas = document.getElementById("canvas");
	if (window.innerWidth * 0.55 > window.innerHeight)
	{ // height will be the limiting factor
		canvas.height = window.innerHeight * 0.95;
		canvas.width = canvas.height / 0.55;
	}
	else
	{
		canvas.width = window.innerWidth * 0.95;
		canvas.height = canvas.width * 0.55;
	}
	SCALEFACTOR = canvas.width / 1000;
}

function main()
{
	// Set the background color
	document.body.style.backgroundColor = BACKGROUND_COLOR;

	///// LISTENERS /////
	// Get rid of annoying text select
	canvas.addEventListener("selectstart", function(e)
	{
		e.preventDefault();
		return false;
	}, false);

	// Responsive to resizing
	var resizeTimer;
	$(window).resize(function()
	{
		clearTimeout(resizeTimer);
		resizeTimer = setTimeout(function()
		{
			doResize();
			var ctx = drawCanvas();
			drawBlobs(ctx);
		});
	});

	// Click to choose a location
	canvas.addEventListener("click", function(e)
	{
		// Only let them click once
		if (clicked)
			return;
		clicked = true;
		var x = e.pageX - canvas.offsetLeft;
		var y = e.pageY - canvas.offsetTop;

		getData();
		var ctx = drawCanvas();

		// This gives enough time for the data to return
		setTimeout(function(){
			drawBlobsInterval(ctx, 0);
		}, 1000);

		// console.log(data);
	});
	///// LISTENERS /////

	doResize();
	drawCanvas();
}

/* Get the existing data from wherever */
function getData()
{
	/* PARSE */
	Parse.initialize("mEmM0UeRE8GX5hYcuI3Z8Yao4bT4Z7wTWyjOImvt", "G5gLmYiSdDo9YNHF56Rrom15e7VJyGYmUYlcu7f9");
	var MapPoint = Parse.Object.extend("MapPoint");
	var query = new Parse.Query(MapPoint);
	query.each(function(object){
  		// console.log(object.get("x") + " " + object.get("y") + " " + object.get("color"));
  		blobs.push(new Blob(object.get("x"), object.get("y"), object.get("color")));
  	});
}

/* Draws the map onto the canvas */
function drawCanvas()
{
	var canvas = document.getElementById("canvas");
	// console.log("drawCanvas called. width: " + canvas.width + " height: " + canvas.height);

	var ctx = canvas.getContext("2d");
	ctx.fillStyle = BACKGROUND_COLOR;
	ctx.fillRect(0, 0, canvas.width, canvas.height);
	// ctx.strokeStyle = "rgb(0,0,0)";
	// ctx.strokeRect(0, 0, canvas.width, canvas.height);
	ctx.drawImage(map, 0, 0, canvas.width, canvas.height);

	return ctx;
}

/* Draws the blobs immediately, no delay */
function drawBlobs(ctx)
{
	for (var i in blobs)
	{
		blobs[i].draw(ctx);
	}
}

/* Draws the blobs one by one */
function drawBlobsInterval(ctx, i)
{
	setTimeout(function(){
		blobs[i].draw(ctx);
		i++;
		if (i < blobs.length)
			drawBlobsInterval(ctx, i);
	}, BLOB_DRAW_INTERVAL);
}

//// BLOB ////

function Blob(x, y, color)
{
	// console.log("created new blob");
	this.x = parseInt(x);
	this.y = parseInt(y);
	this.color = color;
}

/* Not really a blob anymore but I'm still calling it a blob. */
Blob.prototype.draw = function(ctx)
{
	// console.log("draw a blob: " + this.color);
	ctx.fillStyle = this.color;
	ctx.strokeStyle = "#FFFFFF";

	var path = new Path2D();
	path.arc(this.x * SCALEFACTOR, this.y * SCALEFACTOR, (BLOB_SIZE - 4) * SCALEFACTOR,
		0, Math.PI * 2);
	ctx.fill(path);
	ctx.stroke(path);

	var path = new Path2D();
	path.arc(this.x * SCALEFACTOR, this.y * SCALEFACTOR, (BLOB_SIZE - 1) * SCALEFACTOR,
		0.3 * Math.PI, 0.7 * Math.PI);
	path.lineTo((this.x - BLOB_SIZE - 1) * SCALEFACTOR, (this.y + BLOB_SIZE + 3) * SCALEFACTOR);
	path.lineTo((this.x + BLOB_SIZE + 1) * SCALEFACTOR, (this.y + BLOB_SIZE + 3) * SCALEFACTOR);
	path.closePath();
	ctx.fill(path);
	ctx.stroke(path);
}<commit_msg>clicking on map now changes the x/y of the latest point, but doesn't get placed into map quite right<commit_after>INTERVAL = 0;
BLOB_SIZE = 10;
BLOB_DRAW_INTERVAL = 50;
SCALEFACTOR = 1.0;
BACKGROUND_COLOR = "#1D1D1D";

/* Libraries used
jQuery: http://jquery.com/ */
var map = new Image();
map.src = "./img/map.png";
var blobs = [];
var clicked = false;

/* Fit the canvas properly inside the window
1000 * 550 are the "baseline" dimensions */
function doResize()
{
	var canvas = document.getElementById("canvas");
	if (window.innerWidth * 0.55 > window.innerHeight)
	{ // height will be the limiting factor
		canvas.height = window.innerHeight * 0.95;
		canvas.width = canvas.height / 0.55;
	}
	else
	{
		canvas.width = window.innerWidth * 0.95;
		canvas.height = canvas.width * 0.55;
	}
	SCALEFACTOR = canvas.width / 1000;
}

function main()
{
	// Set the background color
	document.body.style.backgroundColor = BACKGROUND_COLOR;

	///// LISTENERS /////
	// Get rid of annoying text select
	canvas.addEventListener("selectstart", function(e)
	{
		e.preventDefault();
		return false;
	}, false);

	// Responsive to resizing
	var resizeTimer;
	$(window).resize(function()
	{
		clearTimeout(resizeTimer);
		resizeTimer = setTimeout(function()
		{
			doResize();
			var ctx = drawCanvas();
			drawBlobs(ctx);
		});
	});

	Parse.initialize("mEmM0UeRE8GX5hYcuI3Z8Yao4bT4Z7wTWyjOImvt", "G5gLmYiSdDo9YNHF56Rrom15e7VJyGYmUYlcu7f9");
	var MapPoint = Parse.Object.extend("MapPoint");

	// Click to choose a location
	canvas.addEventListener("click", function(e)
	{
		// Only let them click once
		if (clicked)
			return;
		clicked = true;
		var x = e.pageX - canvas.offsetLeft;
		var y = e.pageY - canvas.offsetTop;

		var query = new Parse.Query(MapPoint);
		// Sorts the results in descending order by the Created Date field
		query = query.addDescending("createdAt");

		query.first().then(function(object){
			object.set("x", x);
			object.set("y", y);
			console.log(object.get("x") + " " + object.get("y") + " " + object.get("color"));

			object.save(null, {
			  success: function(object) {
			    // Execute any logic that should take place after the object is saved.
			  },
			  error: function(object, error) {
			    // Execute any logic that should take place if the save fails.
			    // error is a Parse.Error with an error code and message.
			    alert("error occurred while saving");
			  }
			});

		});

		getData();
		var ctx = drawCanvas();

		// This gives enough time for the data to return
		setTimeout(function(){
			drawBlobsInterval(ctx, 0);
		}, 1000);

		// console.log(data);
	});
	///// LISTENERS /////

	doResize();
	drawCanvas();
}

/* Get the existing data from wherever */
function getData()
{
	/* PARSE */
	Parse.initialize("mEmM0UeRE8GX5hYcuI3Z8Yao4bT4Z7wTWyjOImvt", "G5gLmYiSdDo9YNHF56Rrom15e7VJyGYmUYlcu7f9");
	var MapPoint = Parse.Object.extend("MapPoint");
	var query = new Parse.Query(MapPoint);
	query.each(function(object){
  		// console.log(object.get("x") + " " + object.get("y") + " " + object.get("color"));
  		blobs.push(new Blob(object.get("x"), object.get("y"), object.get("color")));
  	});
}

/* Draws the map onto the canvas */
function drawCanvas()
{
	var canvas = document.getElementById("canvas");
	// console.log("drawCanvas called. width: " + canvas.width + " height: " + canvas.height);

	var ctx = canvas.getContext("2d");
	ctx.fillStyle = BACKGROUND_COLOR;
	ctx.fillRect(0, 0, canvas.width, canvas.height);
	// ctx.strokeStyle = "rgb(0,0,0)";
	// ctx.strokeRect(0, 0, canvas.width, canvas.height);
	ctx.drawImage(map, 0, 0, canvas.width, canvas.height);

	return ctx;
}

/* Draws the blobs immediately, no delay */
function drawBlobs(ctx)
{
	for (var i in blobs)
	{
		blobs[i].draw(ctx);
	}
}

/* Draws the blobs one by one */
function drawBlobsInterval(ctx, i)
{
	setTimeout(function(){
		blobs[i].draw(ctx);
		i++;
		if (i < blobs.length)
			drawBlobsInterval(ctx, i);
	}, BLOB_DRAW_INTERVAL);
}

//// BLOB ////

function Blob(x, y, color)
{
	// console.log("created new blob");
	this.x = parseInt(x);
	this.y = parseInt(y);
	this.color = color;
}

/* Not really a blob anymore but I'm still calling it a blob. */
Blob.prototype.draw = function(ctx)
{
	// console.log("draw a blob: " + this.color);
	ctx.fillStyle = this.color;
	ctx.strokeStyle = "#FFFFFF";

	var path = new Path2D();
	path.arc(this.x * SCALEFACTOR, this.y * SCALEFACTOR, (BLOB_SIZE - 4) * SCALEFACTOR,
		0, Math.PI * 2);
	ctx.fill(path);
	ctx.stroke(path);

	var path = new Path2D();
	path.arc(this.x * SCALEFACTOR, this.y * SCALEFACTOR, (BLOB_SIZE - 1) * SCALEFACTOR,
		0.3 * Math.PI, 0.7 * Math.PI);
	path.lineTo((this.x - BLOB_SIZE - 1) * SCALEFACTOR, (this.y + BLOB_SIZE + 3) * SCALEFACTOR);
	path.lineTo((this.x + BLOB_SIZE + 1) * SCALEFACTOR, (this.y + BLOB_SIZE + 3) * SCALEFACTOR);
	path.closePath();
	ctx.fill(path);
	ctx.stroke(path);
}<|endoftext|>


<commit_before>(function (root, factory) {
    'use strict';

    if (typeof define === 'function' && define.amd) {
        define(['backbone', 'underscore', 'marionette'], factory);
    }
    else {
        root.Marionette.Modal = factory(root.Backbone, root._, root.Marionette);
    }
}(this, function (Backbone, _, Marionette) {
    'use strict';

    // default model
    var ModalModel = Backbone.Model.extend({
        defaults: {
            isActive: false
        }
    });

    // control collection
    var ModalCollection = Backbone.Collection.extend({
        model: ModalModel,

        initialize: function () {
            this.on('destroy', this.onDestroy);
        },

        getActive: function () {
            return this.findWhere({ isActive: true });
        },

        hasActive: function () {
            return this.some(function (model) {
                return model.get('isActive');
            });
        },

        onDestroy: function (model) {
            var group = model.get('group');

            if (group !== void 0) {
                var models = this.where({ group: group });

                this.remove(models);
            }

            this.reactivate();
        },

        reactivate: function () {
            var model = this.last();

            if (model !== void 0) {
                model.set('isActive', true);
            }
        }
    });

    // overlay
    var OverlayView = Marionette.ItemView.extend({
        template: false,
        el: '#modal-overlay',

        events: {
            'click': 'onClick'
        },

        toggle: function (state) {
            if (state) {
                return this.$el.fadeIn(200);
            }

            return this.$el.fadeOut(200);
        },

        onClick: function () {
            this.trigger('click');
        }
    });

    // modal
    var ModalView = Marionette.LayoutView.extend({
        template: _.template('

'),

        events: {
            'click .js-submit': 'onSubmit',
            'click .js-reject': 'onReject'
        },

        className: function () {
            var _className = 'modal';
            var className = this.model.get('className');

            if (_.isString(className)) {
                _className += ' ' + className;
            }

            return _className;
        },

        modelEvents: {
            'change:isActive': 'onChangeActive',
            'reject': 'onReject',
            'submit': 'onSubmit'
        },

        regions: {
            contentRegion: '.modal-content-region'
        },

        onRender: function () {
            var View = this.model.get('View');

            this.contentRegion.show(new View);
            this.toggle(this.model.get('isActive'));
        },

        toggle: function (state) {
            var self = this;
            var offset = Backbone.$(window).scrollTop();

            if (state) {
                this.$el.show()
                    .css({ top: offset + 'px', opacity: 0 })
                    .animate({ top: offset + 100 + 'px', opacity: 1 }, 200, 'linear');
            }
            else {
                this.$el.animate({ top: offset + 'px', opacity: 0 }, 200, 'linear', function () {
                    self.$el.hide();
                });
            }
        },

        onChangeActive: function (model, value) {
            this.toggle(value);
        },

        onSubmit: function () {
            var self = this;
            var submitStatus = this.contentRegion.currentView.triggerMethod('submit');

            // prevent closing if onSubmit method of child view returns "false"
            if (submitStatus === false) {
                return;
            }

            Backbone.$.when(submitStatus).done(function () {
                self.closeModal();
            });
        },

        onReject: function () {
            var cancelStatus = this.contentRegion.currentView.triggerMethod('reject');

            // prevent closing if onReject method of child view returns "false"
            if (cancelStatus === false) {
                return;
            }

            this.closeModal();
        },

        closeModal: function () {
            var self = this;
            var offset = Backbone.$(window).scrollTop();

            this.$el.animate({ top: offset + 'px', opacity: 0 }, 200, 'linear', function () {
                self.model.destroy();
            });
        }
    });

    // modal container
    var ModalContainer = Marionette.CollectionView.extend({
        el: '#modal-container',
        sort: false,
        childView: ModalView
    });

    // constructor
    var ModalController = function () {
        this._settings = {};

        // initialize overlay once
        this.overlay = (new OverlayView).render();

        this.collection = new ModalCollection;

        this.container = new ModalContainer({
            collection: this.collection
        });

        this.container.render();

        this.listenTo(this.overlay, 'click', this.onReject);
        this.listenTo(this.container, 'add:child remove:child', this.toggleOverlay);
    };

    // controller methods
    _.extend(ModalController.prototype, Backbone.Events, {
        add: function (item) {
            if (item.isActive) {
                this.collection.invoke('set', 'isActive', false);
            }
            else if (this.collection.length === 0) {
                item.isActive = true;
            }

            this.collection.add(item);
        },

        onReject: function () {
            var activeModal = this.collection.getActive();

            if (activeModal !== void 0) {
                activeModal.trigger('reject');
            }
        },

        onSubmit: function () {
            var activeModal = this.collection.getActive();

            if (activeModal !== void 0) {
                activeModal.trigger('submit');
            }
        },

        toggleOverlay: function () {
            this.overlay.toggle(this.collection.length > 0);
        },

        configure: function (settings) {
            if (settings.EA) {
                this._resetEvents(settings.EA);
            }
        },

        _resetEvents: function (EA) {
            if (this._settings.EA) {
                this.stopListening(this._settings.EA);
            }

            this._settings.EA = EA;

            this.listenTo(EA, 'submit', this.onSubmit);
            this.listenTo(EA, 'reject', this.onReject);
        }
    });

    return new ModalController;
}));
<commit_msg>Add navigation through modals on same group.<commit_after>(function (root, factory) {
    'use strict';

    if (typeof define === 'function' && define.amd) {
        define(['backbone', 'underscore', 'marionette'], factory);
    }
    else {
        root.Marionette.Modal = factory(root.Backbone, root._, root.Marionette);
    }
}(this, function (Backbone, _, Marionette) {
    'use strict';

    // default model
    var ModalModel = Backbone.Model.extend({
        defaults: {
            isActive: false
        },

        isNew: function () {
            return true;
        }
    });

    // control collection
    var ModalCollection = Backbone.Collection.extend({
        model: ModalModel,

        initialize: function () {
            this.on('destroy', this.onDestroy);
        },

        getActive: function () {
            return this.findWhere({ isActive: true });
        },

        hasActive: function () {
            return this.some(function (model) {
                return model.get('isActive');
            });
        },

        getGroup: function (model) {
            var group = model.get('group');

            if (group !== void 0) {
                return this.where({ group: group });
            }

            return [];
        },

        onDestroy: function (model) {
            var models = this.getGroup(model);

            if (models.length > 0) {
                this.remove(models);
            }

            this.reactivate();
        },

        reactivate: function () {
            var model = this.last();

            if (model !== void 0) {
                model.set('isActive', true);
            }
        }
    });

    // overlay
    var OverlayView = Marionette.ItemView.extend({
        template: false,

        el: '#modal-overlay',

        events: {
            'click': 'onClick'
        },

        toggle: function (state) {
            if (state) {
                return this.$el.fadeIn(200);
            }

            return this.$el.fadeOut(200);
        },

        onClick: function () {
            this.trigger('click');
        }
    });

    // modal
    var ModalView = Marionette.LayoutView.extend({
        template: _.template('

'),

        events: {
            'click .js-submit:not(.js-disabled)': 'onSubmit',
            'click .js-reject': 'onReject',
            'click .js-next': 'onNext',
            'click .js-previous': 'onPrevious'
        },

        className: function () {
            var _className = 'modal';
            var className = this.model.get('className');

            if (_.isString(className)) {
                _className += ' ' + className;
            }

            return _className;
        },

        modelEvents: {
            'change:isActive': 'onChangeActive',
            'reject': 'onReject',
            'submit': 'onSubmit'
        },

        regions: {
            contentRegion: '.modal-content-region'
        },

        onRender: function () {
            var View = this.model.get('View');

            this.contentRegion.show(new View);
            this.toggle(this.model.get('isActive'));
        },

        toggle: function (state) {
            var self = this;
            var offset = Backbone.$(window).scrollTop();

            if (state) {
                this.$el.show()
                    .css({ top: offset + 'px', opacity: 0 })
                    .animate({ top: offset + 100 + 'px', opacity: 1 }, 200, 'linear');
            }
            else {
                this.$el.animate({ top: offset + 'px', opacity: 0 }, 200, 'linear', function () {
                    self.$el.hide();
                });
            }
        },

        onChangeActive: function (model, value) {
            this.toggle(value);
        },

        onSubmit: function (event) {
            var target = event.currentTarget;

            var self = this;
            var submitStatus = this.contentRegion.currentView.triggerMethod('submit');

            // prevent closing if onSubmit method of child view returns "false"
            if (submitStatus === false) {
                return;
            }

            target.classList.add('disabled', 'js-disabled');

            Backbone.$.when(submitStatus)
                .done(function () {
                    self.closeModal();
                })
                .fail(function () {
                    target.classList.remove('disabled', 'js-disabled');
                });
        },

        onReject: function () {
            var cancelStatus = this.contentRegion.currentView.triggerMethod('reject');

            // prevent closing if onReject method of child view returns "false"
            if (cancelStatus === false) {
                return;
            }

            this.closeModal();
        },

        onNext: function () {
            var modalId = this.contentRegion.currentView.triggerMethod('next');

            this._toggleModal(modalId);
        },

        onPrevious: function () {
            var modalId = this.contentRegion.currentView.triggerMethod('previous');

            this._toggleModal(modalId);
        },

        _toggleModal: function (modalId) {
            // prevent switching modals if methods of child view returns "false"
            if (modalId === false) {
                return;
            }

            var targetModal = this.model.collection.get(modalId);

            if (targetModal === void 0) {
                throw new Marionette.Error({
                    message: 'modal dialog with id "' + modalId + '" not found',
                    name: 'ModalException'
                });
            }

            this.model.set('isActive', false);
            targetModal.set('isActive', true);
        },

        closeModal: function () {
            var self = this;
            var offset = Backbone.$(window).scrollTop();

            this.$el.animate({ top: offset + 'px', opacity: 0 }, 200, 'linear', function () {
                self.model.destroy();
            });
        }
    });

    // modal container
    var ModalContainer = Marionette.CollectionView.extend({
        el: '#modal-container',
        sort: false,
        childView: ModalView
    });

    // constructor
    var ModalController = function () {
        this._settings = {};

        // initialize overlay once
        this.overlay = (new OverlayView).render();

        this.collection = new ModalCollection;

        this.container = new ModalContainer({
            collection: this.collection
        });

        this.container.render();

        this.listenTo(this.overlay, 'click', this.onReject);
        this.listenTo(this.container, 'add:child remove:child', this.toggleOverlay);
    };

    // controller methods
    _.extend(ModalController.prototype, Backbone.Events, {
        add: function (item) {
            if (item.isActive) {
                this.collection.invoke('set', 'isActive', false);
            }
            else if (this.collection.length === 0) {
                item.isActive = true;
            }

            this.collection.add(item);
        },

        onReject: function () {
            var activeModal = this.collection.getActive();

            if (activeModal !== void 0) {
                activeModal.trigger('reject');
            }
        },

        onSubmit: function () {
            var activeModal = this.collection.getActive();

            if (activeModal !== void 0) {
                activeModal.trigger('submit');
            }
        },

        toggleOverlay: function () {
            this.overlay.toggle(this.collection.length > 0);
        },

        configure: function (settings) {
            if (settings.EA) {
                this._resetEvents(settings.EA);
            }
        },

        _resetEvents: function (EA) {
            if (this._settings.EA) {
                this.stopListening(this._settings.EA);
            }

            this._settings.EA = EA;

            this.listenTo(EA, 'submit', this.onSubmit);
            this.listenTo(EA, 'reject', this.onReject);
        }
    });

    return new ModalController;
}));
<|endoftext|>


<commit_before>import { Line, mixins } from 'vue-chartjs';

export default Line.extend({
	mixins: [mixins.reactiveProp],

	mounted() {
		this.renderChart(
			this.chartData,
			{
				responsive: true,
				maintainAspectRatio: false,

				legend: {
					display: false
				},

				hover: {
					intersect: false,
					mode: 'x',
					animationDuration: 0
				},

				tooltips: {
					mode: 'x',
					position: 'average',
					intersect: false
				},

				scales: {
					yAxes: [{
						gridLines: {
							display: true
						}
					}]
				}
			}
		);
	}
});<commit_msg>Update LineChart component to work with the latest vue-chartjs.<commit_after>import { Line, mixins } from 'vue-chartjs';

export default {

	extends: Line,
	mixins: [mixins.reactiveProp],

	mounted() {
		this.renderChart(
			this.chartData,
			{
				responsive: true,
				maintainAspectRatio: false,

				legend: {
					display: false
				},

				hover: {
					intersect: false,
					mode: 'x',
					animationDuration: 0
				},

				tooltips: {
					mode: 'x',
					position: 'average',
					intersect: false
				},

				scales: {
					yAxes: [{
						gridLines: {
							display: true
						}
					}]
				}
			}
		);
	}
};
<|endoftext|>


<commit_before>var shell = require('shelljs');
module.exports = function (version, cb) {
  // npm
  if (shell.test('-f', 'package.json')) {
    // TODO: Use shellquote
    // TODO: Avoid exec altogether
    shell.exec('node -e "f = \'./package.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');

    // If there is a build script, run it
    // TODO: This should be an opt-in action (not everyone will share this opinion)
    var result = shell.exec('node -e "f = \'./package.json\'; p = require(f); process.exit(+(!(p.scripts || {}).build))"');
    if (result.code === 0) {
      shell.exec('npm run build');
    }
  }

  // bower
  if (shell.test('-f', 'bower.json')) {
    shell.exec('node -e "f = \'./bower.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');
  }

  // component
  if (shell.test('-f', 'component.json')) {
    shell.exec('node -e "f = \'./component.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');
  }

  // Python
  if (shell.test('-f', 'setup.py')) {
    shell.exec('node -e "fs = require(\'fs\'); f = \'./setup.py\'; p = fs.readFileSync(f, \'utf8\'); v = \'' + version + '\'; p = p.replace(/version=\'\\d+.\\d+.\\d+\'/, \'version=\\\'\' + v + \'\\\'\'); fs.writeFileSync(f, p, \'utf8\');"');
  }

  // Callback
  cb();
};<commit_msg>Removed build step from pre-release.js<commit_after>var shell = require('shelljs');
module.exports = function (version, cb) {
  // npm
  if (shell.test('-f', 'package.json')) {
    // TODO: Use shellquote
    // TODO: Avoid exec altogether
    shell.exec('node -e "f = \'./package.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');
  }

  // bower
  if (shell.test('-f', 'bower.json')) {
    shell.exec('node -e "f = \'./bower.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');
  }

  // component
  if (shell.test('-f', 'component.json')) {
    shell.exec('node -e "f = \'./component.json\'; p = require(f); p.version = \'' + version + '\'; require(\'fs\').writeFileSync(f, JSON.stringify(p, null, 2));"');
  }

  // Python
  if (shell.test('-f', 'setup.py')) {
    shell.exec('node -e "fs = require(\'fs\'); f = \'./setup.py\'; p = fs.readFileSync(f, \'utf8\'); v = \'' + version + '\'; p = p.replace(/version=\'\\d+.\\d+.\\d+\'/, \'version=\\\'\' + v + \'\\\'\'); fs.writeFileSync(f, p, \'utf8\');"');
  }

  // Callback
  cb();
};<|endoftext|>


<commit_before>/**
  Manages loading GIFs from various external
  feeds.
*/
window.Gifs = {

  /**
    All the gifs
  */
  all: function(){
    return Store.gifs;
  },

  /**
    Return a gif from the gifs pool by ID
  */
  forID: function(id) {
    if (Store.gifs.length == 0) {
      return null;
    }

    var found = _.find(Store.gifs, function(gif){
      return gif.id == id;
    });

    return found;
  },

  /**
    Return a random gif
  */
  random: function(){
    var i = Math.round(Math.random() * Store.gifs.length),
        gif = Store.gifs[i];

    if (_.compact(gif).length == 0) {
      throw "No gifs are loaded yet";
    }

    // Error
    if (!gif) {
      console.error('No gif at index', i);
      return this.random();
    }

    return gif;
  },

  /**
    Load gifs from Giphy and Reddit and returns a
    promise that will resolve as soon as the first source is done

    @param {boolean} forceUpdate Force the gif update
    @returns Promise
  */
  loadNewGifs: function(forceUpdate) {
    var dfd = new jQuery.Deferred(),
        now = Date.now(),
        gifLen = Store.gifs.length;

    // Don't load new gifs unless it's been 12 hours
    // or we've gone through at least 1/4 of the existing pool
    if (forceUpdate !== true
        && gifLen > 0
        && Store.randomChooseCount < (gifLen / 4)
        && now - Store.lastFeedUpdate < (60 * 60 * 12 * 1000)) {
      dfd.resolve();
      return dfd.promise();
    }

    lastFeedUpdate = now;
    randomChooseCount = 0;

    // Clear all gifs, except what is in history
    Store.gifs = Store.gifs.filter(function(gif) {
      return Store.history.indexOf(gif.id) > -1;
    });

    // Reddit
    if (Store.settings.reddit !== false) {
      $.get('http://www.reddit.com/r/gifs/.json?limit=100')
      .then((function(xhr){

        xhr.data.children.forEach(function(gif){
          gif = gif.data;

          var type  = gif.url.match(/\.([^\.]*)$/)[1],
              id    = "r"+ gif.id;

          // Skip
          if (gif.over_18 || gif.thumbnail == 'nsfw' || type != 'gif') {
            return;
          }

          // Update gif storage
          Store.addGif({
            id: id,
            url: gif.url,
            thumb: gif.thumbnail,
            sources: ["http://reddit.com/"+ gif.permalink],
            feed: 'reddit',
            title: gif.title
          });
        });

        // Save gifs to storage
        Store.save('gifs').then(function(){
          dfd.resolve();
        });
      }).bind(this));
    }

    // Giphy
    if (Store.settings.giphy !== false) {
      $.get('http://api.giphy.com/v1/gifs/trending?api_key=11zvNWrJ4cOCJi&limit=100')
      .then((function(xhr){

        xhr.data.forEach(function(gif){
          var id = "g"+ gif.id,
              sources = [gif.url];

          // Skip NSFW
          if (gif.rating.match(/r|x/i)) {
            return;
          }

          // Add external source
          if (gif.source != '') {
            sources.push(gif.source);
          }

          // Setup gif storage
          Store.addGif({
            id: id,
            url: gif.images.original.url,
            thumb: gif.images.fixed_height_still.url,
            sources: sources,
            feed: 'giphy',
            title: gif.title
          });
        });

        // Save gifs to storage
        Store.save('gifs').then(function(){
          dfd.resolve();
        });
      }).bind(this));
    }

    return dfd.promise();
  }

}
<commit_msg>Make sure random gif has not been used the last 20 times.<commit_after>/**
  Manages loading GIFs from various external
  feeds.
*/
window.Gifs = {

  /**
    All the gifs
  */
  all: function(){
    return Store.gifs;
  },

  /**
    Return a gif from the gifs pool by ID or undefined if not found
  */
  forID: function(id) {
    if (Store.gifs.length == 0) {
      return undefined;
    }
    return _.findWhere(Store.gifs, {id: id});
  },

  /**
    Return a random gif
  */
  random: function(){
    Store.gifs = _.compact(Store.gifs);

    var i, gif,
        tries = 0,
        numGifs = Store.gifs.length,
        numHist = _.compact(Store.history).length;

    // Be sure to remove any undefined parts of the gif array
    if (Store.gifs.length == 0) {
      throw "No gifs are loaded yet";
    }

    // Loop until we find a good random one
    do {
      i = Math.round(Math.random() * numGifs),
      gif = Store.gifs[i];

      // It has already been used
      if (gif && Store.history.indexOf(gif.id) > -1 && tries < 10) {
        gif = null;
        tries++;
      }
    } while(!gif && tries < 10);

    return gif;
  },

  /**
    Load gifs from Giphy and Reddit and returns a
    promise that will resolve as soon as the first source is done

    @param {boolean} forceUpdate Force the gif update
    @returns Promise
  */
  loadNewGifs: function(forceUpdate) {
    var dfd = new jQuery.Deferred(),
        now = Date.now(),
        gifLen = Store.gifs.length;

    // Don't load new gifs unless it's been 12 hours
    // or we've gone through at least 1/4 of the existing pool
    if (forceUpdate !== true
        && gifLen > 0
        && Store.randomChooseCount < (gifLen / 4)
        && now - Store.lastFeedUpdate < (60 * 60 * 12 * 1000)) {
      dfd.resolve();
      return dfd.promise();
    }

    lastFeedUpdate = now;
    randomChooseCount = 0;

    // Clear all gifs, except what is in history
    Store.gifs = Store.gifs.filter(function(gif) {
      return Store.history.indexOf(gif.id) > -1;
    });

    // Reddit
    if (Store.settings.reddit !== false) {
      $.get('http://www.reddit.com/r/gifs/.json?limit=100')
      .then((function(xhr){

        xhr.data.children.forEach(function(gif){
          gif = gif.data;

          var type  = gif.url.match(/\.([^\.]*)$/)[1],
              id    = "r"+ gif.id;

          // Skip
          if (gif.over_18 || gif.thumbnail == 'nsfw' || type != 'gif') {
            return;
          }

          // Update gif storage
          Store.addGif({
            id: id,
            url: gif.url,
            thumb: gif.thumbnail,
            sources: ["http://reddit.com/"+ gif.permalink],
            feed: 'reddit',
            title: gif.title
          });
        });

        // Save gifs to storage
        Store.save('gifs').then(function(){
          dfd.resolve();
        });
      }).bind(this));
    }

    // Giphy
    if (Store.settings.giphy !== false) {
      $.get('http://api.giphy.com/v1/gifs/trending?api_key=11zvNWrJ4cOCJi&limit=100')
      .then((function(xhr){

        xhr.data.forEach(function(gif){
          var id = "g"+ gif.id,
              sources = [gif.url];

          // Skip NSFW
          if (gif.rating.match(/r|x/i)) {
            return;
          }

          // Add external source
          if (gif.source != '') {
            sources.push(gif.source);
          }

          // Setup gif storage
          Store.addGif({
            id: id,
            url: gif.images.original.url,
            thumb: gif.images.fixed_height_still.url,
            sources: sources,
            feed: 'giphy',
            title: gif.title
          });
        });

        // Save gifs to storage
        Store.save('gifs').then(function(){
          dfd.resolve();
        });
      }).bind(this));
    }

    return dfd.promise();
  }

}
<|endoftext|>


<commit_before>animate = function() {
	var canvas = document.getElementById('myCanvas');
	var context = canvas.getContext('2d');

	// update
	y += dir;
	if (y > 600 - imgLogo.height || y < 0) {
		dir *= -1;
	}
	// clear
	// context.clearRect(0, 0, canvas.width, canvas.height);

	// draw stuff
	context.drawImage(imgBackground, 0, 0);
	context.drawImage(imgLogo, 0, y);
	context.drawImage(imgMiddleground, 0, 0);
	// request new frame
	requestAnimFrame(function() {
		animate();
	});
}
window.requestAnimFrame = (function(callback) {
	return window.requestAnimationFrame || window.webkitRequestAnimationFrame
			|| window.mozRequestAnimationFrame || window.oRequestAnimationFrame
			|| window.msRequestAnimationFrame || function(callback) {
				window.setTimeout(callback, 1000 / 60);
			};
})();
var y = 0;
var dir = 1;
var imgLogo = new Image();
imgLogo.src = 'gfx/menu/logo.png';
var imgMiddleground = new Image();
imgMiddleground.src = "gfx/menu/menu_middleground.png";
var imgBackground = new Image();
imgBackground.src = "gfx/menu/menu_background.png";
var music = new Audio("sounds/music/Chiptune_2step_mp3.mp3");

main = function() {
	animate();
	music.loop = true;
	music.volume = .25;
	music.load();
}
<commit_msg>draw logo on top, not behind<commit_after>animate = function() {
	var canvas = document.getElementById('myCanvas');
	var context = canvas.getContext('2d');

	// update
	y += dir;
	if (y > 600 - imgLogo.height || y < 0) {
		dir *= -1;
	}
	// clear
	// context.clearRect(0, 0, canvas.width, canvas.height);

	// draw stuff
	context.drawImage(imgBackground, 0, 0);
	context.drawImage(imgMiddleground, 0, 0);
	context.drawImage(imgLogo, 0, y);
	// request new frame
	requestAnimFrame(function() {
		animate();
	});
}
window.requestAnimFrame = (function(callback) {
	return window.requestAnimationFrame || window.webkitRequestAnimationFrame
			|| window.mozRequestAnimationFrame || window.oRequestAnimationFrame
			|| window.msRequestAnimationFrame || function(callback) {
				window.setTimeout(callback, 1000 / 60);
			};
})();
var y = 0;
var dir = 1;
var imgLogo = new Image();
imgLogo.src = 'gfx/menu/logo.png';
var imgMiddleground = new Image();
imgMiddleground.src = "gfx/menu/menu_middleground.png";
var imgBackground = new Image();
imgBackground.src = "gfx/menu/menu_background.png";
var music = new Audio("sounds/music/Chiptune_2step_mp3.mp3");

main = function() {
	animate();
	music.loop = true;
	music.volume = .25;
	music.load();
}
<|endoftext|>


<commit_before>$(function() {

    var sldContainer = $(".slider-container");
    var prevBtn = $(".slider-arrow-left");
    var nextBtn = $(".slider-arrow-right");
    var sliderElms = $(".slider-container").find(".slider-item-wrapper");
    var currentImg = sliderElms.filter(".active");
    var nextImg = sliderElms.filter(":not('.active')");
    var galleryBackgnd = $(".big-gallery-item");
    var galleryCounter = 0;
    var toTopArrow = $(".to-top-container");
    var menuGalBtn = $(".main-menu-gallery");
    var menuGalGrd = $(".main-gallery-grid");
    var sldGalInfWrp = $(".slider-gallery-info-wrapper");
    var hmbgMenu = $(".mobile-hamburger-menu");
    var mainMenuWrp = $(".main-menu-wrapper");
    var infiniteSld = setInterval(sliderChange, 5000);
    var mobileMenuItms = $(".main-menu-item");
    var menuCntBtn = $(".main-menu-contact");
    var cntForm = $(".main-menu-form");
    var formItself = $("form");
    var nameInput = formItself.find("#menu-contact-name");
    var emailInput = formItself.find("#menu-contact-mail");
    var messageInput = formItself.find("#menu-contact-message");
    var errMsg = formItself.find(".menu-error-message");
    var menuHmWrp = $(".menu-home-wrapper");
    var mainHmBtn = $(".main-menu-home");

    function menuHomeHandler() {
        mainHmBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            menuHmWrp.fadeToggle(2000);
            sldGalInfWrp.css("display", "none");
        });
    }

    menuHomeHandler();

    function formHandler() {

        menuCntBtn.on("click", function(e) {
            cntForm.fadeToggle(2000);
            sldGalInfWrp.css("display", "none");
        });

        formItself.on("submit", function(e) {
            e.stopImmediatePropagation();
            var nameVal = nameInput.val();
            var emailVal = emailInput.val();
            var msgVal = messageInput.val();
            var errVal = "";

            if(nameVal.length < 3) {
                errMsg.css("border", "1px solid red");
                errVal += "
Imię jest za krótkie!
";
            }
            if(msgVal.length < 15) {
                errMsg.css("border", "1px solid red");
                errVal += "
Treść wiadomości jest zbyt krótka!
";
            }
            if(emailVal.indexOf("@") == -1 || emailVal.indexOf(".") == -1) {
                errMsg.css("border", "1px solid red");
                errVal += "
Adres email nie zawiera znaku @ lub . !
";
            }
            if(errVal !== "") {
                event.preventDefault();
                errMsg.html(errVal);
            }
        });
    }

    formHandler();

    function menuGalMvmnt() {

        menuGalBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            if($(window).width() < 800) {
                menuGalGrd.fadeToggle(1000);
                sldGalInfWrp.css("display", "none");
                mobileMenuItms.each(function() {
                    if($(this).index() == 0) {
                        $(this).css("display", "none");
                    } else if($(this).index() == 2) {
                        $(this).css("display", "none");
                    }
                });
            } else {
                menuGalGrd.fadeToggle(2000);
                if(sldGalInfWrp.hasClass("blurDown") == false) {
                    sldGalInfWrp.removeClass("blurUp").addClass("blurDown");
                } else {
                    sldGalInfWrp.removeClass("blurDown").addClass("blurUp");
                }
            }
        });
    }

    menuGalMvmnt();

    function galleryPainter() {
        galleryBackgnd.each(function(galleryCounter) {
            galleryCounter++;
            if(galleryCounter % 2 == 1) {
                $(this).addClass("odd-item-bColor");
            }
        });
    }

    galleryPainter();

    function mainMenuSliding() {
        hmbgMenu.on("click", function(e) {
            e.stopImmediatePropagation();

            mainMenuWrp.slideToggle("slow", function() {
                sldContainer.animate({
                    "margin-top": "0"
                }, "slow");

            });
        });
    }

    mainMenuSliding();

    function sliderChange() {

        sliderElms.each(function() {
            if($(this).hasClass("active") == false) {
                $(this).css("display", "none");
            }
        });

        if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }
    }

    sliderChange();

    nextBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            clearInterval(infiniteSld);

            if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }

            infiniteSld = setInterval(sliderChange, 5000);
        });

    prevBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            clearTimeout(infiniteSld);

            if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }

            infiniteSld = setInterval(sliderChange, 5000);
        });

    function toppingViewport() {
        $(window).scroll(function() {
            if($(this).scrollTop() > 100) {
                toTopArrow.fadeIn();
            } else {
                toTopArrow.fadeOut();
            }
        });

        toTopArrow.on("click", function(e) {
            e.stopImmediatePropagation();
            $("body").animate({
                scrollTop: 0
            }, 1000);
            return false;
        });
    }

    toppingViewport();
});
<commit_msg>changes and tests to the JS functions handling menu elements relations<commit_after>$(function() {

    var sldContainer = $(".slider-container");
    var prevBtn = $(".slider-arrow-left");
    var nextBtn = $(".slider-arrow-right");
    var sliderElms = $(".slider-container").find(".slider-item-wrapper");
    var currentImg = sliderElms.filter(".active");
    var nextImg = sliderElms.filter(":not('.active')");
    var galleryBackgnd = $(".big-gallery-item");
    var galleryCounter = 0;
    var toTopArrow = $(".to-top-container");
    var menuGalBtn = $(".main-menu-gallery");
    var menuGalGrd = $(".main-gallery-grid");
    var sldGalInfWrp = $(".slider-gallery-info-wrapper");
    var hmbgMenu = $(".mobile-hamburger-menu");
    var mainMenuWrp = $(".main-menu-wrapper");
    var infiniteSld = setInterval(sliderChange, 5000);
    var mobileMenuItms = $(".main-menu-item");
    var menuCntBtn = $(".main-menu-contact");
    var cntForm = $(".main-menu-form");
    var formItself = $("form");
    var nameInput = formItself.find("#menu-contact-name");
    var emailInput = formItself.find("#menu-contact-mail");
    var messageInput = formItself.find("#menu-contact-message");
    var errMsg = formItself.find(".menu-error-message");
    var menuHmWrp = $(".menu-home-wrapper");
    var mainHmBtn = $(".main-menu-home");

    function eventsHandling() {

        if(mainHmBtn.data("clicked") == true) {
            menuGalGrd.css("display", "none");
            cntForm.css("display", "none");
        }

        //this function should check if the certain attribte is true and execute the condition or not

        //this function should be invoked before the logic of the buttons functions
    }

//    eventsHandling();

    function menuHomeHandler() {
        mainHmBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            $(this).data("cliked", true);

            menuHmWrp.fadeToggle(2000);
            sldGalInfWrp.css("display", "none");
        });
    }

    menuHomeHandler();

    function formHandler() {

        menuCntBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            $(this).data("cliked", true);

            cntForm.fadeToggle(2000);
            sldGalInfWrp.css("display", "none");
        });

        formItself.on("submit", function(e) {
            e.stopImmediatePropagation();
            var nameVal = nameInput.val();
            var emailVal = emailInput.val();
            var msgVal = messageInput.val();
            var errVal = "";

            if(nameVal.length < 3) {
                errMsg.css("border", "1px solid red");
                errVal += "
Imię jest za krótkie!
";
            }
            if(msgVal.length < 15) {
                errMsg.css("border", "1px solid red");
                errVal += "
Treść wiadomości jest zbyt krótka!
";
            }
            if(emailVal.indexOf("@") == -1 || emailVal.indexOf(".") == -1) {
                errMsg.css("border", "1px solid red");
                errVal += "
Adres email nie zawiera znaku @ lub . !
";
            }
            if(errVal !== "") {
                event.preventDefault();
                errMsg.html(errVal);
            }
        });
    }

    formHandler();

    function menuGalMvmnt() {

        menuGalBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            $(this).data("cliked", true);

            eventsHandling();

            if($(window).width() < 800) {
                menuGalGrd.fadeToggle(1000);
                sldGalInfWrp.css("display", "none");
                mobileMenuItms.each(function() {
                    if($(this).index() == 0) {
                        $(this).css("display", "none");
                    } else if($(this).index() == 2) {
                        $(this).css("display", "none");
                    }
                });
            } else {
                menuGalGrd.fadeToggle(2000);
                if(sldGalInfWrp.hasClass("blurDown") == false) {
                    sldGalInfWrp.removeClass("blurUp").addClass("blurDown");
                } else {
                    sldGalInfWrp.removeClass("blurDown").addClass("blurUp");
                }
            }
        });
    }

    menuGalMvmnt();

    function galleryPainter() {
        galleryBackgnd.each(function(galleryCounter) {
            galleryCounter++;
            if(galleryCounter % 2 == 1) {
                $(this).addClass("odd-item-bColor");
            }
        });
    }

    galleryPainter();

    function mainMenuSliding() {
        hmbgMenu.on("click", function(e) {
            e.stopImmediatePropagation();

            mainMenuWrp.slideToggle("slow", function() {
                sldContainer.animate({
                    "margin-top": "0"
                }, "slow");

            });
        });
    }

    mainMenuSliding();

    function sliderChange() {

        sliderElms.each(function() {
            if($(this).hasClass("active") == false) {
                $(this).css("display", "none");
            }
        });

        if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }
    }

    sliderChange();

    nextBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            clearInterval(infiniteSld);

            if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }

            infiniteSld = setInterval(sliderChange, 5000);
        });

    prevBtn.on("click", function(e) {
            e.stopImmediatePropagation();

            clearTimeout(infiniteSld);

            if(currentImg.hasClass("active") == true) {
                currentImg.removeClass("active").css("display", "none");
                nextImg.addClass("active").css("display", "block");
            } else {
                currentImg.addClass("active").css("display", "block");
                nextImg.removeClass("active").css("display", "none");
            }

            infiniteSld = setInterval(sliderChange, 5000);
        });

    function toppingViewport() {
        $(window).scroll(function() {
            if($(this).scrollTop() > 100) {
                toTopArrow.fadeIn();
            } else {
                toTopArrow.fadeOut();
            }
        });

        toTopArrow.on("click", function(e) {
            e.stopImmediatePropagation();
            $("body").animate({
                scrollTop: 0
            }, 1000);
            return false;
        });
    }

    toppingViewport();
});
<|endoftext|>


<commit_before>var skype = ''+
'
'+
' '+
'
';

var home = "
\

\
Welcome to my page\

\

\
Here you will find all you might need to know about me as well as my portfolio of\
\
 projects.\
\

\
You may also contact me through the link on the bottom of the page.
Hope to hear from you soon!\

"+ skype +"
"

var about = "
\

\
I am a creative and driven developer from Venezuela, that has had experience in the fields of engineering and finance. My foundation as an industrial engineer has sharpened my analytical and problem solving skills and has molded the way I tackle new obstacles. My studies in finance have honed my understanding of the business side of things and has given me the tools to be able to successfully start a business of my own web based business in my home country destined to solve the difficulties of finding professional service providers.\

\

\
My first work experience introduced me to web development, giving me the opportunity to become part of UX design teams and implement new and creative ways of optimizing user usability and experience in the company's website.  Later on, working as a monitoring coordinator for machinery software I was presented with the opportunity to  lead a web based project where I was able to work hand in hand with web developers and designers, ultimately leading to my interest in the tech industry.\

\

\
Ever since, I have dedicated all of my time and energy to gain the required knowledge needed to fully understand how to bring my ideas to life through code and tackle larger and more complex projects. Through my courses at Columbia and the completion of a 19 week developer bootcamp I am certain I have achieved this goal.\

\

\
Im driven by the need to elevate the quality of life through tech based undertakings and demonstrate the dynamism of tech in fields that have yet to adopt it by providing solutions through meaningful applications. \

\

\
I see myself in a position where I can have the liberty of pitching ideas and giving life to my creations, where I can learn from other programmers and leave my footprint in the tech world.\

\

"

var resume = "
\

\

\
PROFESSIONAL EXPERIENCE\

\

\

\
	\
	MEGA (KOMATSU DISTRIBUTOR), Guarenas, Venezuela 2013-2015

 Komtrax Fleet Monitoring Coordinator/IT Manager\

\

\
	Developed automatic fleet report system for construction and mining equipment, reducing time required for reporting data by 45%; implemented system health meter that reflected equipment functionality.\

\

\
	Restructured all reports to persuade clients to use Komtrax System, resulting in improved consumer satisfaction and retention.\

\

\
	Directed follow-up process to ensure all machines equipped with Komtrax were successfully completing satellite diagnostic process; offered customer and IT support for all of Komatsu’s Platforms.\

\

\
	Projected future spare parts sales based on information analysis derived from the Komtrax system.\

\

\
	Co-Led design and development of Mega’s own web and mobile monitoring platform with programming agency providing hands-on experience with programmers and programming languages.\

\

\
	\
	MOVISTAR VENEZUELA, Caracas, Venezuela 2012

Intern (Full-Time)\

\

\
	Optimized billing and recharge systems for the largest mobile phone service provider in Venezuela; teamed with programmers to developed new coding for digital account platform, modifying the visual and sensorial interaction of many of its transactions in order to provide a more attractive and efficient customer experience.\

\

\
	Coordinated marketing, design and web development divisions in order to provide an alternative that would alleviate difficulties in all aspects of customer interaction within the virtual platform.\

\

\
	Developed transaction manuals and routine follow-ups to ensure optimal system implementation achieving significant improvement in customer service; proposed optimization of multiple transactions available in virtual platform “Mi Movistar”.\

\

\
	\
	PLUMROSE VENEZUELA (FOOD INDUSTRY), Caracas, Venezuela 2012

Intern (Part-Time)\

\

\
	Contributed to introduction and launch of all new frozen Plumrose products (Iceberg Project) including coding and registration processes; developed model to project distribution of all new frozen products, helping define launch goals.\

\

\
	Analyzed and controlled sales and inventory of Eveba canned products and Conaprole cheese products.\

\

\
	Developed transaction manuals and routine follow-ups to ensure optimal system implementation achieving significant improvement in customer service; proposed optimization of multiple transactions available in virtual platform “Mi Movistar”.\

\

\
	OTHER PROFESSIONAL EXPERIENCE 2014-Present\

\

\
	Founder and CEO of web based company www.dconfianza.com that will connect Venezuelans with professional service providers such as home cleaning services, contractors, and other professionals, set to launch mid-2016.\

\

\
	Supported Maquinarias Mega as freelance visual basic programmer; developed excel programs optimizing to a great scale the current after-sales reporting processes, and consequently achieving payroll reduction.\

\

\

\

\
	_____________________________________________________________________________________________________________\

\

\

\
EDUCATION\

\

\

\
	\
	COLUMBIA UNIVERSITY, Graduate Foundation’s Certificate 2015, New York, NY\

\

\
	Completed rigorous three-month session focused on computer science courses, learning basic Java programming, Data Structures, Statistics with calculus and social media networking for organizations.\

\

\
	\
	IESA, Masters in Finance 2013-2015, Caracas, Venezuela\

\

\
	Completed this top 6th finance graduate program in Latin America, as ranked by Eduniversal Best Masters.\

\

\
	\
	UNIVERSIDAD METROPOLITANA, Bachelor of Science in Production Engineering 2007-2013, Caracas,Venezuela\

\

\
	Led thesis project “Improvements in Self-Management Transactions for Mobile Phone Operator Movistar;” collaborated with coders to implement new and improved processes in the virtual platforms, enhancing productivity and user experience.\

\

\
	OTHER EDUCATION\

\

\
	La Sorbonne, Paris, France French Language and Civilization Course Debutant Level 2006 – 2007.\

\

\
	Scuola Leonardo Da Vinci, Florence, Italy Italian Language Course Intermediate Level 2006 – 2007.\

\

\

\

\
	_____________________________________________________________________________________________________________\

\

\

\
ADDITIONAL\n\

\

\

\

\
	Languages: Spanish (Native tongue), English (Advanced And Fluent), Italian (Basic), French (Basic)\

\

\
	Advanced computer software knowledge in: Word, Excel, PowerPoint, Visual Basic,Javascript,Html, Ruby On Ralis\

\

\
	Volunteered at Voluntad Popular (political party led by Leopoldo Lopez, top contender for Hugo Chavez), led the mass fund recollection project “Ceibas;” conceptualized pyramid structure 1x10 that would optimize management of funds,2011\

\

\
	Enjoy programming, boxing, listening to music, caring for my two beagles.\

\

\

\

";

var projects = "
\
\
www.dconfianza.com\
\

\
\
\

";

function change(link)
{
	var txt = link.text
	switch(txt) {
		case "Home":
		document.getElementById('information-container').innerHTML = home;
		break;
		case "About":
		document.getElementById('information-container').innerHTML = about;
		break;
		case "Resume":
		document.getElementById('information-container').innerHTML = resume;
		break;
		case "Projects":
		document.getElementById('information-container').innerHTML = projects;
		break;
		default:
	}
}
<commit_msg>Remove division lines between resume sections<commit_after>var skype = ''+
'
'+
' '+
'
';

var home = "
\

\
Welcome to my page\

\

\
Here you will find all you might need to know about me as well as my portfolio of\
\
 projects.\
\

\
You may also contact me through the link on the bottom of the page.
Hope to hear from you soon!\

"+ skype +"
"

var about = "
\

\
I am a creative and driven developer from Venezuela, that has had experience in the fields of engineering and finance. My foundation as an industrial engineer has sharpened my analytical and problem solving skills and has molded the way I tackle new obstacles. My studies in finance have honed my understanding of the business side of things and has given me the tools to be able to successfully start a business of my own web based business in my home country destined to solve the difficulties of finding professional service providers.\

\

\
My first work experience introduced me to web development, giving me the opportunity to become part of UX design teams and implement new and creative ways of optimizing user usability and experience in the company's website.  Later on, working as a monitoring coordinator for machinery software I was presented with the opportunity to  lead a web based project where I was able to work hand in hand with web developers and designers, ultimately leading to my interest in the tech industry.\

\

\
Ever since, I have dedicated all of my time and energy to gain the required knowledge needed to fully understand how to bring my ideas to life through code and tackle larger and more complex projects. Through my courses at Columbia and the completion of a 19 week developer bootcamp I am certain I have achieved this goal.\

\

\
Im driven by the need to elevate the quality of life through tech based undertakings and demonstrate the dynamism of tech in fields that have yet to adopt it by providing solutions through meaningful applications. \

\

\
I see myself in a position where I can have the liberty of pitching ideas and giving life to my creations, where I can learn from other programmers and leave my footprint in the tech world.\

\

"

var resume = "
\

\

\
PROFESSIONAL EXPERIENCE\

\

\

\
	\
	MEGA (KOMATSU DISTRIBUTOR), Guarenas, Venezuela 2013-2015

 Komtrax Fleet Monitoring Coordinator/IT Manager\

\

\
	Developed automatic fleet report system for construction and mining equipment, reducing time required for reporting data by 45%; implemented system health meter that reflected equipment functionality.\

\

\
	Restructured all reports to persuade clients to use Komtrax System, resulting in improved consumer satisfaction and retention.\

\

\
	Directed follow-up process to ensure all machines equipped with Komtrax were successfully completing satellite diagnostic process; offered customer and IT support for all of Komatsu’s Platforms.\

\

\
	Projected future spare parts sales based on information analysis derived from the Komtrax system.\

\

\
	Co-Led design and development of Mega’s own web and mobile monitoring platform with programming agency providing hands-on experience with programmers and programming languages.\

\

\
	\
	MOVISTAR VENEZUELA, Caracas, Venezuela 2012

Intern (Full-Time)\

\

\
	Optimized billing and recharge systems for the largest mobile phone service provider in Venezuela; teamed with programmers to developed new coding for digital account platform, modifying the visual and sensorial interaction of many of its transactions in order to provide a more attractive and efficient customer experience.\

\

\
	Coordinated marketing, design and web development divisions in order to provide an alternative that would alleviate difficulties in all aspects of customer interaction within the virtual platform.\

\

\
	Developed transaction manuals and routine follow-ups to ensure optimal system implementation achieving significant improvement in customer service; proposed optimization of multiple transactions available in virtual platform “Mi Movistar”.\

\

\
	\
	PLUMROSE VENEZUELA (FOOD INDUSTRY), Caracas, Venezuela 2012

Intern (Part-Time)\

\

\
	Contributed to introduction and launch of all new frozen Plumrose products (Iceberg Project) including coding and registration processes; developed model to project distribution of all new frozen products, helping define launch goals.\

\

\
	Analyzed and controlled sales and inventory of Eveba canned products and Conaprole cheese products.\

\

\
	Developed transaction manuals and routine follow-ups to ensure optimal system implementation achieving significant improvement in customer service; proposed optimization of multiple transactions available in virtual platform “Mi Movistar”.\

\

\
	OTHER PROFESSIONAL EXPERIENCE 2014-Present\

\

\
	Founder and CEO of web based company www.dconfianza.com that will connect Venezuelans with professional service providers such as home cleaning services, contractors, and other professionals, set to launch mid-2016.\

\

\
	Supported Maquinarias Mega as freelance visual basic programmer; developed excel programs optimizing to a great scale the current after-sales reporting processes, and consequently achieving payroll reduction.\

\

\

\

\

\

\

\
EDUCATION\

\

\

\
	\
	COLUMBIA UNIVERSITY, Graduate Foundation’s Certificate 2015, New York, NY\

\

\
	Completed rigorous three-month session focused on computer science courses, learning basic Java programming, Data Structures, Statistics with calculus and social media networking for organizations.\

\

\
	\
	IESA, Masters in Finance 2013-2015, Caracas, Venezuela\

\

\
	Completed this top 6th finance graduate program in Latin America, as ranked by Eduniversal Best Masters.\

\

\
	\
	UNIVERSIDAD METROPOLITANA, Bachelor of Science in Production Engineering 2007-2013, Caracas,Venezuela\

\

\
	Led thesis project “Improvements in Self-Management Transactions for Mobile Phone Operator Movistar;” collaborated with coders to implement new and improved processes in the virtual platforms, enhancing productivity and user experience.\

\

\
	OTHER EDUCATION\

\

\
	La Sorbonne, Paris, France French Language and Civilization Course Debutant Level 2006 – 2007.\

\

\
	Scuola Leonardo Da Vinci, Florence, Italy Italian Language Course Intermediate Level 2006 – 2007.\

\

\

\

\

\

\

\
ADDITIONAL\n\

\

\

\

\
	Languages: Spanish (Native tongue), English (Advanced And Fluent), Italian (Basic), French (Basic)\

\

\
	Advanced computer software knowledge in: Word, Excel, PowerPoint, Visual Basic,Javascript,Html, Ruby On Ralis\

\

\
	Volunteered at Voluntad Popular (political party led by Leopoldo Lopez, top contender for Hugo Chavez), led the mass fund recollection project “Ceibas;” conceptualized pyramid structure 1x10 that would optimize management of funds,2011\

\

\
	Enjoy programming, boxing, listening to music, caring for my two beagles.\

\

\

\

";

var projects = "
\
\
www.dconfianza.com\
\

\
\
\

";

function change(link)
{
	var txt = link.text
	switch(txt) {
		case "Home":
		document.getElementById('information-container').innerHTML = home;
		break;
		case "About":
		document.getElementById('information-container').innerHTML = about;
		break;
		case "Resume":
		document.getElementById('information-container').innerHTML = resume;
		break;
		case "Projects":
		document.getElementById('information-container').innerHTML = projects;
		break;
		default:
	}
}
<|endoftext|>