', {
+ id: config.mapModuleId
+ });
+ }
+
+ return mapModule;
+ };
+
+ /**
+ * get Area ID by security string
+ * @param security
+ * @returns {number}
+ */
+ let getAreaIdBySecurity = function(security){
+
+ let areaId = 0;
+
+ switch(security){
+ case 'H':
+ areaId = 10;
+ break;
+ case 'L':
+ areaId = 11;
+ break;
+ case '0.0':
+ areaId = 12;
+ break;
+ case 'SH':
+ areaId = 13;
+ break;
+ default:
+ // w-space
+ for(let i = 1; i <= 6; i++){
+ if(security === 'C' + i){
+ areaId = i;
+ break;
+ }
+ }
+ break;
+ }
+
+ return areaId;
+ };
+
+ /**
+ * get system effect data by system security and system class
+ * if no search parameters given -> get all effect data
+ * @param security
+ * @param effect
+ * @returns {boolean}
+ */
+ let getSystemEffectData = function(security, effect){
+ let data = SystemEffect;
+ if(security){
+ // look for specific data
+ data = false;
+ let areaId = getAreaIdBySecurity(security);
+
+ if(
+ areaId > 0 &&
+ SystemEffect.wh[effect] &&
+ SystemEffect.wh[effect][areaId]
+ ){
+ data = SystemEffect.wh[effect][areaId];
+ }
+ }
+
+ return data;
+ };
+
+ /**
+ * get status info for a character for a given status
+ * @param characterData
+ * @param option
+ * @returns {string}
+ */
+ let getStatusInfoForCharacter = function(characterData, option){
+
+ let statusInfo = '';
+
+ // character status can not be checked if there are no reference data
+ // e.g. during registration process (login page)
+ if(Init.characterStatus){
+ // get info for current "main" character
+ let corporationId = getCurrentUserInfo('corporationId');
+ let allianceId = getCurrentUserInfo('allianceId');
+
+ // get all user characters
+ let userData = getCurrentUserData();
+
+ if(userData){
+ // check if character is one of his own characters
+ let userCharactersData = userData.characters;
+
+ for(let i = 0; i < userCharactersData.length; i++){
+ if(userCharactersData[i].id === characterData.id){
+ statusInfo = Init.characterStatus.own[option];
+ break;
+ }
+ }
+ }
+
+ if(statusInfo === ''){
+ // compare current user data with given user data
+ if(
+ characterData.corporation &&
+ characterData.corporation.id === corporationId
+ ){
+ statusInfo = Init.characterStatus.corporation[option];
+ }else if(
+ characterData.alliance &&
+ characterData.alliance.id === allianceId
+ ){
+ statusInfo = Init.characterStatus.alliance[option];
+ }
+ }
+ }
+
+ return statusInfo;
+ };
+
+ /**
+ * get a HTML table with system effect information
+ * e.g. for popover
+ * @param data
+ * @returns {string}
+ */
+ let getSystemEffectTable = function(data){
+ let table = '';
+
+ if(data.length > 0){
+
+ table += '
';
+ for(let i = 0; i < data.length; i++){
+ table += '';
+ table += '| ';
+ table += data[i].effect;
+ table += ' | ';
+ table += '';
+ table += data[i].value;
+ table += ' | ';
+ table += '
';
+ }
+ table += '
';
+ }
+
+ return table;
+ };
+
+ /**
+ * get a HTML table with information for multiple systems
+ * e.g. for popover
+ * @param data
+ * @returns {string}
+ */
+ let getSystemsInfoTable = function(data){
+ let table = '';
+
+ if(data.length > 0){
+
+ table += '
';
+ for(let i = 0; i < data.length; i++){
+
+ let trueSecClass = getTrueSecClassForSystem( data[i].trueSec );
+ let securityClass = getSecurityClassForSystem( data[i].security );
+
+ table += '';
+ table += '| ';
+ table += data[i].name;
+ table += ' | ';
+ table += '';
+ table += data[i].security;
+ table += ' | ';
+ table += '';
+ table += parseFloat( data[i].trueSec ).toFixed(1);
+ table += ' | ';
+ table += '
';
+ }
+ table += '
';
+ }
+
+ return table;
+ };
+
+ /**
+ * get a css class for the security level of a system
+ * @param sec
+ * @returns {string}
+ */
+ let getSecurityClassForSystem = function(sec){
+ let secClass = '';
+
+ if( Init.classes.systemSecurity.hasOwnProperty(sec) ){
+ secClass = Init.classes.systemSecurity[sec]['class'];
+ }
+
+ return secClass;
+ };
+
+ /**
+ * get a css class for the trueSec level of a system
+ * @param trueSec
+ * @returns {string}
+ */
+ let getTrueSecClassForSystem = function(trueSec){
+ let trueSecClass = '';
+
+ trueSec = parseFloat(trueSec);
+
+ // check for valid decimal number
+ if(
+ !isNaN( trueSec ) &&
+ isFinite( trueSec )
+ ){
+ if(trueSec < 0){
+ trueSec = 0;
+ }
+
+ trueSec = trueSec.toFixed(1).toString();
+
+ if( Init.classes.trueSec.hasOwnProperty(trueSec) ){
+ trueSecClass = Init.classes.trueSec[trueSec]['class'];
+ }
+ }
+
+ return trueSecClass;
+ };
+
+ /**
+ * get status info
+ * @param status
+ * @param option
+ * @returns {string}
+ */
+ let getStatusInfoForSystem = function(status, option){
+
+ let statusInfo = '';
+
+ if( Init.systemStatus.hasOwnProperty(status) ){
+ // search by status string
+ statusInfo = Init.systemStatus[status][option];
+ }else{
+ // saarch by statusID
+ $.each(Init.systemStatus, function(prop, data){
+
+ if(status === data.id){
+ statusInfo = data[option];
+ return;
+ }
+ });
+ }
+
+ return statusInfo;
+ };
+
+ /**
+ * get signature group information
+ * @param option
+ * @returns {{}}
+ */
+ let getSignatureGroupInfo = function(option){
+
+ let groupInfo = {};
+
+ for (let prop in Init.signatureGroups) {
+ if(Init.signatureGroups.hasOwnProperty(prop)){
+ prop = parseInt(prop);
+ groupInfo[prop] = Init.signatureGroups[prop][option];
+ }
+ }
+
+ return groupInfo;
+ };
+
+ /**
+ * get Signature names out of global
+ * @param systemTypeId
+ * @param areaId
+ * @param sigGroupId
+ * @returns {{}}
+ */
+ let getAllSignatureNames = function(systemTypeId, areaId, sigGroupId){
+
+ let signatureNames = {};
+
+ if(
+ SignatureType[systemTypeId] &&
+ SignatureType[systemTypeId][areaId] &&
+ SignatureType[systemTypeId][areaId][sigGroupId]
+ ){
+ signatureNames = SignatureType[systemTypeId][areaId][sigGroupId];
+ }
+
+ return signatureNames;
+ };
+
+ /**
+ * get the typeID of a signature name
+ * @param systemData
+ * @param sigGroupId
+ * @param name
+ * @returns {number}
+ */
+ let getSignatureTypeIdByName = function(systemData, sigGroupId, name){
+
+ let signatureTypeId = 0;
+
+ let areaId = getAreaIdBySecurity(systemData.security);
+
+ if(areaId > 0){
+ let signatureNames = getAllSignatureNames(systemData.type.id, areaId, sigGroupId );
+ name = name.toLowerCase();
+
+ for(let prop in signatureNames) {
+
+ if(
+ signatureNames.hasOwnProperty(prop) &&
+ signatureNames[prop].toLowerCase() === name
+ ){
+ signatureTypeId = parseInt( prop );
+ break;
+ }
+ }
+ }
+
+ return signatureTypeId;
+ };
+
+ /**
+ * set currentMapUserData as "global" variable (count of active pilots)
+ * this function should be called continuously after data change
+ * to keep the data always up2data
+ * @param mapUserData
+ */
+ let setCurrentMapUserData = function(mapUserData){
+ Init.currentMapUserData = mapUserData;
+
+ return getCurrentMapUserData();
+ };
+
+ /**
+ * get currentMapUserData from "global" variable for specific map or all maps
+ * @param mapId
+ * @returns {boolean}
+ */
+ let getCurrentMapUserData = function(mapId){
+ let currentMapUserData = false;
+
+ if(
+ mapId === parseInt(mapId, 10) &&
+ Init.currentMapUserData
+ ){
+ // search for a specific map
+ for(let i = 0; i < Init.currentMapUserData.length; i++){
+ if(Init.currentMapUserData[i].config.id === mapId){
+ currentMapUserData = Init.currentMapUserData[i];
+ break;
+ }
+ }
+ }else{
+ // get data for all maps
+ currentMapUserData = Init.currentMapUserData;
+ }
+
+ if(currentMapUserData !== false){
+ // return a fresh (deep) copy of that, in case of further modifications
+ currentMapUserData = $.extend(true, {}, currentMapUserData);
+ }
+
+ return currentMapUserData;
+ };
+
+ /**
+ * set currentMapData as "global" variable
+ * this function should be called continuously after data change
+ * to keep the data always up2data
+ * @param mapData
+ */
+ let setCurrentMapData = function(mapData){
+ Init.currentMapData = mapData;
+
+ return getCurrentMapData();
+ };
+
+ /**
+ * get mapData array index by mapId
+ * @param mapId
+ * @returns {boolean|int}
+ */
+ let getCurrentMapDataIndex = function(mapId){
+ let mapDataIndex = false;
+
+ if( mapId === parseInt(mapId, 10) ){
+ for(let i = 0; i < Init.currentMapData.length; i++){
+ if(Init.currentMapData[i].config.id === mapId){
+ mapDataIndex = i;
+ break;
+ }
+ }
+ }
+
+ return mapDataIndex;
+ };
+
+ /**
+ * update cached mapData for a single map
+ * @param mapData
+ */
+ let updateCurrentMapData = function(mapData){
+ let mapDataIndex = getCurrentMapDataIndex( mapData.config.id );
+
+ if(mapDataIndex !== false){
+ Init.currentMapData[mapDataIndex].config = mapData.config;
+ Init.currentMapData[mapDataIndex].data = mapData.data;
+ }else{
+ // new map data
+ Init.currentMapData.push(mapData);
+ }
+ };
+
+ /**
+ * get currentMapData from "global" variable for a specific map or all maps
+ * @param mapId
+ * @returns {boolean}
+ */
+ let getCurrentMapData = function(mapId){
+ let currentMapData = false;
+
+ if( mapId === parseInt(mapId, 10) ){
+ // search for a specific map
+ for(let i = 0; i < Init.currentMapData.length; i++){
+ if(Init.currentMapData[i].config.id === mapId){
+ currentMapData = Init.currentMapData[i];
+ break;
+ }
+ }
+ }else{
+ // get data for all maps
+ currentMapData = Init.currentMapData;
+ }
+
+ return currentMapData;
+ };
+
+ /**
+ * delete map data by mapId from currentMapData
+ * @param mapId
+ */
+ let deleteCurrentMapData = (mapId) => {
+ Init.currentMapData = Init.currentMapData.filter((mapData) => {
+ return (mapData.config.id !== mapId);
+ });
+ };
+
+ /**
+ * set currentUserData as "global" variable
+ * this function should be called continuously after data change
+ * to keep the data always up2data
+ * @param userData
+ */
+ let setCurrentUserData = function(userData){
+ Init.currentUserData = userData;
+
+ // check if function is available
+ // this is not the case in "login" page
+ if( $.fn.updateHeaderUserData ){
+ $.fn.updateHeaderUserData();
+ }
+
+ return getCurrentUserData();
+ };
+
+ /**
+ * get the current log data for the current user character
+ * @returns {boolean}
+ */
+ let getCurrentCharacterLog = function(){
+ let characterLog = false;
+ let currentUserData = getCurrentUserData();
+
+ if(
+ currentUserData &&
+ currentUserData.character &&
+ currentUserData.character.log
+ ){
+ characterLog = currentUserData.character.log;
+ }
+
+ return characterLog;
+ };
+
+ /**
+ * get information for the current mail user
+ * @param option
+ * @returns {boolean}
+ */
+ let getCurrentUserInfo = function(option){
+ let currentUserData = getCurrentUserData();
+ let userInfo = false;
+
+ if(currentUserData){
+ // user data is set -> user data will be set AFTER the main init request!
+ let characterData = currentUserData.character;
+
+ if(characterData){
+ if(
+ option === 'allianceId' &&
+ characterData.alliance
+ ){
+ userInfo = characterData.alliance.id;
+ }
+
+ if(
+ option === 'corporationId' &&
+ characterData.corporation
+ ){
+ userInfo = characterData.corporation.id;
+ }
+ }
+ }
+
+ return userInfo;
+ };
+
+ /**
+ * get "nearBy" systemData based on a jump radius around a currentSystem
+ * @param currentSystemData
+ * @param currentMapData
+ * @param jumps
+ * @param foundSystemIds
+ * @returns {{systemData: *, tree: {}}}
+ */
+ let getNearBySystemData = (currentSystemData, currentMapData, jumps, foundSystemIds = {}) => {
+
+ // look for systemData by ID
+ let getSystemData = (systemId) => {
+ for(let j = 0; j < currentMapData.data.systems.length; j++){
+ let systemData = currentMapData.data.systems[j];
+ if(systemData.id === systemId){
+ return systemData;
+ }
+ }
+ return false;
+ };
+
+ // skip systems that are already found in recursive calls
+ foundSystemIds[currentSystemData.id] = {distance: jumps};
+
+ let nearBySystems = {
+ systemData: currentSystemData,
+ tree: {}
+ };
+
+ jumps--;
+ if(jumps >= 0){
+ for(let i = 0; i < currentMapData.data.connections.length; i++){
+ let connectionData = currentMapData.data.connections[i];
+ let type = ''; // "source" OR "target"
+ if(connectionData.source === currentSystemData.id){
+ type = 'target';
+ }else if(connectionData.target === currentSystemData.id){
+ type = 'source';
+ }
+
+ if(
+ type &&
+ (
+ foundSystemIds[connectionData[type]] === undefined ||
+ foundSystemIds[connectionData[type]].distance < jumps
+ )
+ ){
+ let newSystemData = getSystemData(connectionData[type]);
+ if(newSystemData){
+ nearBySystems.tree[connectionData[type]] = getNearBySystemData(newSystemData, currentMapData, jumps, foundSystemIds);
+ }
+ }
+ }
+ }
+ return nearBySystems;
+ };
+
+ /**
+ * get current character data from all characters who are "nearby" the current user
+ * -> see getNearBySystemData()
+ * @param nearBySystems
+ * @param userData
+ * @param jumps
+ * @param data
+ * @returns {{}}
+ */
+ let getNearByCharacterData = (nearBySystems, userData, jumps = 0, data = {}) => {
+
+ let getCharacterDataBySystemId = (systemId) => {
+ for(let i = 0; i < userData.length; i++){
+ if(userData[i].id === systemId){
+ return userData[i].user;
+ }
+ }
+ return [];
+ };
+
+ let filterFinalCharData = function(tmpFinalCharData){
+ return this.id !== tmpFinalCharData.id;
+ };
+
+ let characterData = getCharacterDataBySystemId(nearBySystems.systemData.systemId);
+
+ if(characterData.length){
+ // filter (remove) characterData for "already" added chars
+ characterData = characterData.filter(function(tmpCharacterData, index, allData){
+ let keepData = true;
+
+ for(let tmpJump in data) {
+ // just scan systems with > jumps than current system
+ if(tmpJump > jumps){
+ let filteredFinalData = data[tmpJump].filter(filterFinalCharData, tmpCharacterData);
+
+ if(filteredFinalData.length > 0){
+ data[tmpJump] = filteredFinalData;
+ }else{
+ delete data[tmpJump];
+ }
+ }else{
+ for(let k = 0; k < data[tmpJump].length; k++){
+ if(data[tmpJump][k].id === tmpCharacterData.id){
+ keepData = false;
+ break;
+ }
+ }
+ }
+ }
+
+ return keepData;
+ });
+
+ data[jumps] = data[jumps] ? data[jumps] : [];
+ data[jumps] = [...data[jumps], ...characterData];
+ }
+
+ jumps++;
+ for(let prop in nearBySystems.tree) {
+ if( nearBySystems.tree.hasOwnProperty(prop) ){
+ let tmpSystemData = nearBySystems.tree[prop];
+ data = getNearByCharacterData(tmpSystemData, userData, jumps, data);
+ }
+ }
+
+ return data;
+ };
+
+ /**
+ * set new destination for a system
+ * @param systemData
+ * @param type
+ */
+ let setDestination = function(systemData, type){
+ let description = '';
+ switch(type){
+ case 'set_destination':
+ description = 'Set destination';
+ break;
+ case 'add_first_waypoint':
+ description = 'Set first waypoint';
+ break;
+ case 'add_last_waypoint':
+ description = 'Set new waypoint';
+ break;
+ }
+
+ $.ajax({
+ type: 'POST',
+ url: Init.path.setDestination,
+ data: {
+ clearOtherWaypoints: (type === 'set_destination') ? 1 : 0,
+ first: (type === 'add_last_waypoint') ? 0 : 1,
+ systemData: [{
+ systemId: systemData.systemId,
+ name: systemData.name
+ }]
+ },
+ context: {
+ description: description
+ },
+ dataType: 'json'
+ }).done(function(responseData){
+ if(
+ responseData.systemData &&
+ responseData.systemData.length > 0
+ ){
+ for (let j = 0; j < responseData.systemData.length; j++) {
+ showNotify({title: this.description, text: 'System: ' + responseData.systemData[j].name, type: 'success'});
+ }
+ }
+
+ if(
+ responseData.error &&
+ responseData.error.length > 0
+ ){
+ for(let i = 0; i < responseData.error.length; i++){
+ showNotify({title: this.description + ' error', text: 'System: ' + responseData.error[i].message, type: 'error'});
+ }
+ }
+
+ }).fail(function( jqXHR, status, error) {
+ let reason = status + ' ' + error;
+ showNotify({title: jqXHR.status + ': ' + this.description, text: reason, type: 'warning'});
+ });
+ };
+
+ /**
+ * set currentSystemData as "global" variable
+ * @param systemData
+ */
+ let setCurrentSystemData = function(systemData){
+ Init.currentSystemData = systemData;
+ };
+
+ /**
+ * get currentSystemData from "global" variables
+ * @returns {*}
+ */
+ let getCurrentSystemData = function(){
+ return Init.currentSystemData;
+ };
+
+ /**
+ * get current location data
+ * -> system data where current user is located
+ * @returns {{id: *, name: *}}
+ */
+ let getCurrentLocationData = function(){
+ let currentLocationLink = $('#' + config.headCurrentLocationId).find('a');
+ return {
+ id: currentLocationLink.data('systemId'),
+ name: currentLocationLink.data('systemName')
+ };
+ };
+
+ /**
+ * get all "open" dialog elements
+ * @returns {*|jQuery}
+ */
+ let getOpenDialogs = function(){
+ return $('.' + config.dialogClass).filter(':visible');
+ };
+
+ /**
+ * send Ajax request that remote opens an ingame Window
+ * @param targetId
+ */
+ let openIngameWindow = (targetId) => {
+ targetId = parseInt(targetId);
+
+ if(targetId > 0){
+ $.ajax({
+ type: 'POST',
+ url: Init.path.openIngameWindow,
+ data: {
+ targetId: targetId
+ },
+ dataType: 'json'
+ }).done(function(data){
+ if(data.error.length > 0){
+ showNotify({title: 'Open window in client', text: 'Remote window open failed', type: 'error'});
+ }else{
+ showNotify({title: 'Open window in client', text: 'Check your EVE client', type: 'success'});
+ }
+ }).fail(function( jqXHR, status, error) {
+ let reason = status + ' ' + error;
+ showNotify({title: jqXHR.status + ': openWindow', text: reason, type: 'error'});
+ });
+ }
+ };
+
+ /**
+ * formats a price string into an ISK Price
+ * @param price
+ * @returns {string}
+ */
+ let formatPrice = function(price){
+ price = Number( price ).toFixed(2);
+
+ let parts = price.toString().split('.');
+ price = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',') + (parts[1] ? '.' + parts[1] : '');
+
+ return price + ' ISK';
+ };
+
+ /**
+ * get localForage instance (singleton) for offline client site storage
+ * @returns {localforage}
+ */
+ let getLocalStorage = function(){
+ if(localStorage === undefined){
+ localStorage = localforage.createInstance({
+ driver: [localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE],
+ name: 'Pathfinder local storage'
+ });
+ }
+ return localStorage;
+ };
+
+ /**
+ * Create Date as UTC
+ * @param date
+ * @returns {Date}
+ */
+ let createDateAsUTC = function(date) {
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
+ };
+
+ /**
+ * Convert Date to UTC (!important function!)
+ * @param date
+ * @returns {Date}
+ */
+ let convertDateToUTC = function(date) {
+ return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
+ };
+
+ /**
+ * Convert Date to Time String
+ * @param date
+ * @returns {string}
+ */
+ let convertDateToString = function(date){
+ let dateString = ('0'+ (date.getMonth() + 1 )).slice(-2) + '/' + ('0'+date.getDate()).slice(-2) + '/' + date.getFullYear();
+ let timeString = ('0' + date.getHours()).slice(-2) + ':' + ('0'+date.getMinutes()).slice(-2);
+ return dateString + ' ' + timeString;
+ };
+
+ /**
+ * get document path
+ * -> www.pathfinder.com/pathfinder/ -> /pathfinder
+ * @returns {string|string}
+ */
+ let getDocumentPath = function(){
+ let pathname = window.location.pathname;
+ // replace file endings
+ let r = /[^\/]*$/;
+ let path = pathname.replace(r, '');
+ return path || '/';
+ };
+
+ /**
+ * redirect
+ * @param url
+ * @param params
+ */
+ let redirect = function(url, params){
+ let currentUrl = document.URL;
+
+ if(url !== currentUrl){
+ if(
+ params &&
+ params.length > 0
+ ){
+ url += '?' + params.join('&');
+ }
+ window.location = url;
+ }
+ };
+
+ /**
+ * send logout request
+ * @param params
+ */
+ let logout = function(params){
+ let data = {};
+ if(
+ params &&
+ params.ajaxData
+ ){
+ data = params.ajaxData;
+ }
+
+ $.ajax({
+ type: 'POST',
+ url: Init.path.logout,
+ data: data,
+ dataType: 'json'
+ }).done(function(data){
+ if(data.reroute){
+ redirect(data.reroute, ['logout']);
+ }
+ }).fail(function( jqXHR, status, error) {
+ let reason = status + ' ' + error;
+ showNotify({title: jqXHR.status + ': logout', text: reason, type: 'error'});
+ });
+ };
+
+ return {
+ config: config,
+ getVersion: getVersion,
+ showVersionInfo: showVersionInfo,
+ initPrototypes: initPrototypes,
+ initDefaultBootboxConfig: initDefaultBootboxConfig,
+ getCurrentTriggerDelay: getCurrentTriggerDelay,
+ getServerTime: getServerTime,
+ convertTimestampToServerTime: convertTimestampToServerTime,
+ getTimeDiffParts: getTimeDiffParts,
+ timeStart: timeStart,
+ timeStop: timeStop,
+ log: log,
+ showNotify: showNotify,
+ stopTabBlink: stopTabBlink,
+ getLogInfo: getLogInfo,
+ ajaxSetup: ajaxSetup,
+ setSyncStatus: setSyncStatus,
+ getSyncType: getSyncType,
+ isXHRAborted: isXHRAborted,
+ getMapElementFromOverlay: getMapElementFromOverlay,
+ getMapModule: getMapModule,
+ getSystemEffectData: getSystemEffectData,
+ getSystemEffectTable: getSystemEffectTable,
+ getSystemsInfoTable: getSystemsInfoTable,
+ getStatusInfoForCharacter: getStatusInfoForCharacter,
+ getSecurityClassForSystem: getSecurityClassForSystem,
+ getTrueSecClassForSystem: getTrueSecClassForSystem,
+ getStatusInfoForSystem: getStatusInfoForSystem,
+ getSignatureGroupInfo: getSignatureGroupInfo,
+ getAllSignatureNames: getAllSignatureNames,
+ getSignatureTypeIdByName: getSignatureTypeIdByName,
+ getAreaIdBySecurity: getAreaIdBySecurity,
+ setCurrentMapUserData: setCurrentMapUserData,
+ getCurrentMapUserData: getCurrentMapUserData,
+ setCurrentMapData: setCurrentMapData,
+ getCurrentMapData: getCurrentMapData,
+ getCurrentMapDataIndex: getCurrentMapDataIndex,
+ updateCurrentMapData: updateCurrentMapData,
+ deleteCurrentMapData: deleteCurrentMapData,
+ setCurrentUserData: setCurrentUserData,
+ getCurrentUserData: getCurrentUserData,
+ setCurrentSystemData: setCurrentSystemData,
+ getCurrentSystemData: getCurrentSystemData,
+ getCurrentLocationData: getCurrentLocationData,
+ getCurrentUserInfo: getCurrentUserInfo,
+ getCurrentCharacterLog: getCurrentCharacterLog,
+ flattenXEditableSelectArray: flattenXEditableSelectArray,
+ getNearBySystemData: getNearBySystemData,
+ getNearByCharacterData: getNearByCharacterData,
+ setDestination: setDestination,
+ convertDateToString: convertDateToString,
+ getOpenDialogs: getOpenDialogs,
+ openIngameWindow: openIngameWindow,
+ formatPrice: formatPrice,
+ getLocalStorage: getLocalStorage,
+ getDocumentPath: getDocumentPath,
+ redirect: redirect,
+ logout: logout
+ };
+});
\ No newline at end of file
diff --git a/public/js/v1.2.4/app/worker/map.js b/public/js/v1.2.4/app/worker/map.js
new file mode 100644
index 00000000..bd524ff7
--- /dev/null
+++ b/public/js/v1.2.4/app/worker/map.js
@@ -0,0 +1,162 @@
+'use strict';
+
+// "fake" window object will contain "MsgWorker" after import
+let window = {}; // jshint ignore:line
+
+// import "MsgWorker" class
+self.importScripts( self.name ); // jshint ignore:line
+
+let MsgWorker = window.MsgWorker;
+let socket = null;
+let ports = [];
+let characterPorts = [];
+
+// init "WebSocket" connection ========================================================================================
+let initSocket = (uri) => {
+ let MsgWorkerOpen = new MsgWorker('ws:open');
+
+ if(socket === null){
+ socket = new WebSocket(uri);
+
+ // "WebSocket" open -----------------------------------------------------------------------
+ socket.onopen = (e) => {
+ MsgWorkerOpen.meta({
+ readyState: socket.readyState
+ });
+
+ sendToCurrentPort(MsgWorkerOpen);
+ };
+
+ // "WebSocket message ---------------------------------------------------------------------
+ socket.onmessage = (e) => {
+ let response = JSON.parse(e.data);
+
+ let MsgWorkerSend = new MsgWorker('ws:send');
+ MsgWorkerSend.task( response.task );
+ MsgWorkerSend.meta({
+ readyState: this.readyState,
+ characterIds: response.characterIds
+ });
+ MsgWorkerSend.data( response.load );
+
+ broadcastPorts(MsgWorkerSend);
+ };
+
+ // "WebSocket" close ----------------------------------------------------------------------
+ socket.onclose = (closeEvent) => {
+ let MsgWorkerClosed = new MsgWorker('ws:closed');
+ MsgWorkerClosed.meta({
+ readyState: socket.readyState,
+ code: closeEvent.code,
+ reason: closeEvent.reason,
+ wasClean: closeEvent.wasClean
+ });
+
+ broadcastPorts(MsgWorkerClosed);
+ socket = null; // reset WebSocket
+ };
+
+ // "WebSocket" error ----------------------------------------------------------------------
+ socket.onerror = (e) => {
+ let MsgWorkerError = new MsgWorker('ws:error');
+ MsgWorkerError.meta({
+ readyState: socket.readyState
+ });
+
+ sendToCurrentPort(MsgWorkerError);
+ };
+ }else{
+ // socket still open
+ MsgWorkerOpen.meta({
+ readyState: socket.readyState
+ });
+ sendToCurrentPort(MsgWorkerOpen);
+ }
+};
+
+// send message to port(s) ============================================================================================
+let sendToCurrentPort = (load) => {
+ ports[ports.length - 1].postMessage(load);
+};
+
+let broadcastPorts = (load) => {
+ // default: sent to all ports
+ let sentToPorts = ports;
+
+ // check if send() is limited to some ports
+ let meta = load.meta();
+ if(
+ meta &&
+ meta.characterIds &&
+ meta.characterIds !== 'undefined' &&
+ meta.characterIds instanceof Array
+ ){
+ // ... get ports for characterIds
+ sentToPorts = getPortsByCharacterIds(meta.characterIds);
+ }
+
+ for (let i = 0; i < sentToPorts.length; i++) {
+ sentToPorts[i].postMessage(load);
+ }
+};
+
+// port functions =====================================================================================================
+let addPort = (port, characterId) => {
+ characterId = parseInt(characterId);
+
+ if(characterId > 0){
+ characterPorts.push({
+ characterId: characterId,
+ port: port
+ });
+ }else{
+ ports.push(port);
+ }
+};
+
+let getPortsByCharacterIds = (characterIds) => {
+ let ports = [];
+
+ for(let i = 0; i < characterPorts.length; i++){
+ for(let j = 0; j < characterIds.length; j++){
+ if(characterPorts[i].characterId === characterIds[j]){
+ ports.push(characterPorts[i].port);
+ }
+ }
+ }
+
+ return ports;
+};
+
+// "SharedWorker" connection ==========================================================================================
+self.addEventListener('connect', (event) => { // jshint ignore:line
+ let port = event.ports[0];
+ addPort(port);
+
+ port.addEventListener('message', (e) => {
+ let MsgWorkerMessage = e.data;
+ Object.setPrototypeOf(MsgWorkerMessage, MsgWorker.prototype);
+
+ switch(MsgWorkerMessage.command){
+ case 'ws:init':
+ let data = MsgWorkerMessage.data();
+ // add character specific port (for broadcast) to individual ports (tabs)
+ addPort(port, data.characterId);
+ initSocket(data.uri);
+ break;
+ case 'ws:send':
+ let MsgSocket = {
+ task: MsgWorkerMessage.task(),
+ load: MsgWorkerMessage.data()
+ };
+
+ socket.send(JSON.stringify(MsgSocket));
+ break;
+ case 'ws:close':
+ // closeSocket();
+ break;
+ }
+ }, false);
+
+ port.start();
+}, false);
\ No newline at end of file
diff --git a/public/js/v1.2.4/app/worker/message.js b/public/js/v1.2.4/app/worker/message.js
new file mode 100644
index 00000000..492eecc1
--- /dev/null
+++ b/public/js/v1.2.4/app/worker/message.js
@@ -0,0 +1,55 @@
+window.MsgWorker = class MessageWorker {
+
+ constructor(cmd){
+ /**
+ * "command" type (identifies this message)
+ */
+ this.cmd = cmd;
+
+ /**
+ * "task" what should be done with this message
+ * @type {string}
+ */
+ this.msgTask = '';
+
+ /**
+ * "message" meta data (e.g. error/close data from WebSocket
+ * @type {null}
+ */
+ this.msgMeta = null;
+
+ /**
+ * "message" body (load)
+ * @type {null}
+ */
+ this.msgBody = null;
+ }
+
+ get command(){
+ return this.cmd;
+ }
+
+ task(task) {
+ if(task){
+ this.msgTask = task;
+ }
+
+ return this.msgTask;
+ }
+
+ meta(metaData) {
+ if(metaData){
+ this.msgMeta = metaData;
+ }
+
+ return this.msgMeta;
+ }
+
+ data(data) {
+ if(data){
+ this.msgBody = data;
+ }
+
+ return this.msgBody;
+ }
+};
\ No newline at end of file
diff --git a/public/js/v1.2.4/lib/EasePack.min.js b/public/js/v1.2.4/lib/EasePack.min.js
new file mode 100644
index 00000000..d94e23b9
--- /dev/null
+++ b/public/js/v1.2.4/lib/EasePack.min.js
@@ -0,0 +1,12 @@
+/*!
+ * VERSION: beta 1.9.4
+ * DATE: 2014-07-17
+ * UPDATES AND DOCS AT: http://www.greensock.com
+ *
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
+ * Club GreenSock members, the software agreement that was issued with your membership.
+ *
+ * @author: Jack Doyle, jack@greensock.com
+ **/
+var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1}),p("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),p("BackInOut",function(t){return 1>(t*=2)?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),m=h("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=i===!0},!0),d=m.prototype=new t;return d.constructor=m,d.getRatio=function(t){var e=t+(.5-t)*this._p;return this._p1>t?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},m.ease=new m(.7,.7),d.config=m.config=function(t,e,i){return new m(t,e,i)},e=h("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0),d=e.prototype=new t,d.constructor=e,d.getRatio=function(t){return 0>t?t=0:t>=1&&(t=.999999999),(this._p2*t>>0)*this._p1},d.config=e.config=function(t){return new e(t)},i=h("easing.RoughEase",function(e){e=e||{};for(var i,s,r,n,a,o,h=e.taper||"none",l=[],_=0,u=0|(e.points||20),p=u,f=e.randomize!==!1,m=e.clamp===!0,d=e.template instanceof t?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;--p>-1;)i=f?Math.random():1/u*p,s=d?d.getRatio(i):i,"none"===h?r=g:"out"===h?(n=1-i,r=n*n*g):"in"===h?r=i*i*g:.5>i?(n=2*i,r=.5*n*n*g):(n=2*(1-i),r=.5*n*n*g),f?s+=Math.random()*r-.5*r:p%2?s+=.5*r:s-=.5*r,m&&(s>1?s=1:0>s&&(s=0)),l[_++]={x:i,y:s};for(l.sort(function(t,e){return t.x-e.x}),o=new c(1,1,null),p=u;--p>-1;)a=l[p],o=new c(a.x,a.y,o);this._prev=new c(0,0,0!==o.t?o:o.next)},!0),d=i.prototype=new t,d.constructor=i,d.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&e.t>=t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},d.config=function(t){return new i(t)},i.ease=new i,u("Bounce",l("BounceOut",function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return 1/2.75>(t=1-t)?1-7.5625*t*t:2/2.75>t?1-(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=.5>t;return t=e?1-2*t:2*t-1,t=1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),u("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return 1>(t*=2)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),s=function(e,i,s){var r=h("easing."+e,function(t,e){this._p1=t||1,this._p2=e||s,this._p3=this._p2/a*(Math.asin(1/this._p1)||0)},!0),n=r.prototype=new t;return n.constructor=r,n.getRatio=i,n.config=function(t,e){return new r(t,e)},r},u("Elastic",s("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*a/this._p2)+1},.3),s("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2))},.3),s("ElasticInOut",function(t){return 1>(t*=2)?-.5*this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2):.5*this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*a/this._p2)+1},.45)),u("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return 1>(t*=2)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),u("Sine",l("SineOut",function(t){return Math.sin(t*o)}),l("SineIn",function(t){return-Math.cos(t*o)+1}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),_(r.SlowMo,"SlowMo","ease,"),_(i,"RoughEase","ease,"),_(e,"SteppedEase","ease,"),f},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();
\ No newline at end of file
diff --git a/public/js/v1.2.4/lib/TweenLite.min.js b/public/js/v1.2.4/lib/TweenLite.min.js
new file mode 100644
index 00000000..1d40adeb
--- /dev/null
+++ b/public/js/v1.2.4/lib/TweenLite.min.js
@@ -0,0 +1,12 @@
+/*!
+ * VERSION: 1.13.1
+ * DATE: 2014-07-22
+ * UPDATES AND DOCS AT: http://www.greensock.com
+ *
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
+ * Club GreenSock members, the software agreement that was issued with your membership.
+ *
+ * @author: Jack Doyle, jack@greensock.com
+ */
+(function(t,e){"use strict";var i=t.GreenSockGlobals=t.GreenSockGlobals||t;if(!i.TweenLite){var s,n,r,a,o,l=function(t){var e,s=t.split("."),n=i;for(e=0;s.length>e;e++)n[s[e]]=n=n[s[e]]||{};return n},h=l("com.greensock"),_=1e-10,u=function(t){var e,i=[],s=t.length;for(e=0;e!==s;i.push(t[e++]));return i},f=function(){},m=function(){var t=Object.prototype.toString,e=t.call([]);return function(i){return null!=i&&(i instanceof Array||"object"==typeof i&&!!i.push&&t.call(i)===e)}}(),p={},c=function(s,n,r,a){this.sc=p[s]?p[s].sc:[],p[s]=this,this.gsClass=null,this.func=r;var o=[];this.check=function(h){for(var _,u,f,m,d=n.length,v=d;--d>-1;)(_=p[n[d]]||new c(n[d],[])).gsClass?(o[d]=_.gsClass,v--):h&&_.sc.push(this);if(0===v&&r)for(u=("com.greensock."+s).split("."),f=u.pop(),m=l(u.join("."))[f]=this.gsClass=r.apply(r,o),a&&(i[f]=m,"function"==typeof define&&define.amd?define((t.GreenSockAMDPath?t.GreenSockAMDPath+"/":"")+s.split(".").pop(),[],function(){return m}):s===e&&"undefined"!=typeof module&&module.exports&&(module.exports=m)),d=0;this.sc.length>d;d++)this.sc[d].check()},this.check(!0)},d=t._gsDefine=function(t,e,i,s){return new c(t,e,i,s)},v=h._class=function(t,e,i){return e=e||function(){},d(t,[],function(){return e},i),e};d.globals=i;var g=[0,0,1,1],T=[],y=v("easing.Ease",function(t,e,i,s){this._func=t,this._type=i||0,this._power=s||0,this._params=e?g.concat(e):g},!0),w=y.map={},P=y.register=function(t,e,i,s){for(var n,r,a,o,l=e.split(","),_=l.length,u=(i||"easeIn,easeOut,easeInOut").split(",");--_>-1;)for(r=l[_],n=s?v("easing."+r,null,!0):h.easing[r]||{},a=u.length;--a>-1;)o=u[a],w[r+"."+o]=w[o+r]=n[o]=t.getRatio?t:t[o]||new t};for(r=y.prototype,r._calcEnd=!1,r.getRatio=function(t){if(this._func)return this._params[0]=t,this._func.apply(null,this._params);var e=this._type,i=this._power,s=1===e?1-t:2===e?t:.5>t?2*t:2*(1-t);return 1===i?s*=s:2===i?s*=s*s:3===i?s*=s*s*s:4===i&&(s*=s*s*s*s),1===e?1-s:2===e?s:.5>t?s/2:1-s/2},s=["Linear","Quad","Cubic","Quart","Quint,Strong"],n=s.length;--n>-1;)r=s[n]+",Power"+n,P(new y(null,null,1,n),r,"easeOut",!0),P(new y(null,null,2,n),r,"easeIn"+(0===n?",easeNone":"")),P(new y(null,null,3,n),r,"easeInOut");w.linear=h.easing.Linear.easeIn,w.swing=h.easing.Quad.easeInOut;var b=v("events.EventDispatcher",function(t){this._listeners={},this._eventTarget=t||this});r=b.prototype,r.addEventListener=function(t,e,i,s,n){n=n||0;var r,l,h=this._listeners[t],_=0;for(null==h&&(this._listeners[t]=h=[]),l=h.length;--l>-1;)r=h[l],r.c===e&&r.s===i?h.splice(l,1):0===_&&n>r.pr&&(_=l+1);h.splice(_,0,{c:e,s:i,up:s,pr:n}),this!==a||o||a.wake()},r.removeEventListener=function(t,e){var i,s=this._listeners[t];if(s)for(i=s.length;--i>-1;)if(s[i].c===e)return s.splice(i,1),void 0},r.dispatchEvent=function(t){var e,i,s,n=this._listeners[t];if(n)for(e=n.length,i=this._eventTarget;--e>-1;)s=n[e],s.up?s.c.call(s.s||i,{type:t,target:i}):s.c.call(s.s||i)};var k=t.requestAnimationFrame,A=t.cancelAnimationFrame,S=Date.now||function(){return(new Date).getTime()},x=S();for(s=["ms","moz","webkit","o"],n=s.length;--n>-1&&!k;)k=t[s[n]+"RequestAnimationFrame"],A=t[s[n]+"CancelAnimationFrame"]||t[s[n]+"CancelRequestAnimationFrame"];v("Ticker",function(t,e){var i,s,n,r,l,h=this,u=S(),m=e!==!1&&k,p=500,c=33,d=function(t){var e,a,o=S()-x;o>p&&(u+=o-c),x+=o,h.time=(x-u)/1e3,e=h.time-l,(!i||e>0||t===!0)&&(h.frame++,l+=e+(e>=r?.004:r-e),a=!0),t!==!0&&(n=s(d)),a&&h.dispatchEvent("tick")};b.call(h),h.time=h.frame=0,h.tick=function(){d(!0)},h.lagSmoothing=function(t,e){p=t||1/_,c=Math.min(e,p,0)},h.sleep=function(){null!=n&&(m&&A?A(n):clearTimeout(n),s=f,n=null,h===a&&(o=!1))},h.wake=function(){null!==n?h.sleep():h.frame>10&&(x=S()-p+5),s=0===i?f:m&&k?k:function(t){return setTimeout(t,0|1e3*(l-h.time)+1)},h===a&&(o=!0),d(2)},h.fps=function(t){return arguments.length?(i=t,r=1/(i||60),l=this.time+r,h.wake(),void 0):i},h.useRAF=function(t){return arguments.length?(h.sleep(),m=t,h.fps(i),void 0):m},h.fps(t),setTimeout(function(){m&&(!n||5>h.frame)&&h.useRAF(!1)},1500)}),r=h.Ticker.prototype=new h.events.EventDispatcher,r.constructor=h.Ticker;var C=v("core.Animation",function(t,e){if(this.vars=e=e||{},this._duration=this._totalDuration=t||0,this._delay=Number(e.delay)||0,this._timeScale=1,this._active=e.immediateRender===!0,this.data=e.data,this._reversed=e.reversed===!0,B){o||a.wake();var i=this.vars.useFrames?q:B;i.add(this,i._time),this.vars.paused&&this.paused(!0)}});a=C.ticker=new h.Ticker,r=C.prototype,r._dirty=r._gc=r._initted=r._paused=!1,r._totalTime=r._time=0,r._rawPrevTime=-1,r._next=r._last=r._onUpdate=r._timeline=r.timeline=null,r._paused=!1;var R=function(){o&&S()-x>2e3&&a.wake(),setTimeout(R,2e3)};R(),r.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},r.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},r.resume=function(t,e){return null!=t&&this.seek(t,e),this.paused(!1)},r.seek=function(t,e){return this.totalTime(Number(t),e!==!1)},r.restart=function(t,e){return this.reversed(!1).paused(!1).totalTime(t?-this._delay:0,e!==!1,!0)},r.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},r.render=function(){},r.invalidate=function(){return this},r.isActive=function(){var t,e=this._timeline,i=this._startTime;return!e||!this._gc&&!this._paused&&e.isActive()&&(t=e.rawTime())>=i&&i+this.totalDuration()/this._timeScale>t},r._enabled=function(t,e){return o||a.wake(),this._gc=!t,this._active=this.isActive(),e!==!0&&(t&&!this.timeline?this._timeline.add(this,this._startTime-this._delay):!t&&this.timeline&&this._timeline._remove(this,!0)),!1},r._kill=function(){return this._enabled(!1,!1)},r.kill=function(t,e){return this._kill(t,e),this},r._uncache=function(t){for(var e=t?this:this.timeline;e;)e._dirty=!0,e=e.timeline;return this},r._swapSelfInParams=function(t){for(var e=t.length,i=t.concat();--e>-1;)"{self}"===t[e]&&(i[e]=this);return i},r.eventCallback=function(t,e,i,s){if("on"===(t||"").substr(0,2)){var n=this.vars;if(1===arguments.length)return n[t];null==e?delete n[t]:(n[t]=e,n[t+"Params"]=m(i)&&-1!==i.join("").indexOf("{self}")?this._swapSelfInParams(i):i,n[t+"Scope"]=s),"onUpdate"===t&&(this._onUpdate=e)}return this},r.delay=function(t){return arguments.length?(this._timeline.smoothChildTiming&&this.startTime(this._startTime+t-this._delay),this._delay=t,this):this._delay},r.duration=function(t){return arguments.length?(this._duration=this._totalDuration=t,this._uncache(!0),this._timeline.smoothChildTiming&&this._time>0&&this._time
this._duration?this._duration:t,e)):this._time},r.totalTime=function(t,e,i){if(o||a.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(0>t&&!i&&(t+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var s=this._totalDuration,n=this._timeline;if(t>s&&!i&&(t=s),this._startTime=(this._paused?this._pauseTime:n._time)-(this._reversed?s-t:t)/this._timeScale,n._dirty||this._uncache(!1),n._timeline)for(;n._timeline;)n._timeline._time!==(n._startTime+n._totalTime)/n._timeScale&&n.totalTime(n._totalTime,!0),n=n._timeline}this._gc&&this._enabled(!0,!1),(this._totalTime!==t||0===this._duration)&&(this.render(t,e,!1),O.length&&M())}return this},r.progress=r.totalProgress=function(t,e){return arguments.length?this.totalTime(this.duration()*t,e):this._time/this.duration()},r.startTime=function(t){return arguments.length?(t!==this._startTime&&(this._startTime=t,this.timeline&&this.timeline._sortChildren&&this.timeline.add(this,t-this._delay)),this):this._startTime},r.timeScale=function(t){if(!arguments.length)return this._timeScale;if(t=t||_,this._timeline&&this._timeline.smoothChildTiming){var e=this._pauseTime,i=e||0===e?e:this._timeline.totalTime();this._startTime=i-(i-this._startTime)*this._timeScale/t}return this._timeScale=t,this._uncache(!1)},r.reversed=function(t){return arguments.length?(t!=this._reversed&&(this._reversed=t,this.totalTime(this._timeline&&!this._timeline.smoothChildTiming?this.totalDuration()-this._totalTime:this._totalTime,!0)),this):this._reversed},r.paused=function(t){if(!arguments.length)return this._paused;if(t!=this._paused&&this._timeline){o||t||a.wake();var e=this._timeline,i=e.rawTime(),s=i-this._pauseTime;!t&&e.smoothChildTiming&&(this._startTime+=s,this._uncache(!1)),this._pauseTime=t?i:null,this._paused=t,this._active=this.isActive(),!t&&0!==s&&this._initted&&this.duration()&&this.render(e.smoothChildTiming?this._totalTime:(i-this._startTime)/this._timeScale,!0,!0)}return this._gc&&!t&&this._enabled(!0,!1),this};var D=v("core.SimpleTimeline",function(t){C.call(this,0,t),this.autoRemoveChildren=this.smoothChildTiming=!0});r=D.prototype=new C,r.constructor=D,r.kill()._gc=!1,r._first=r._last=null,r._sortChildren=!1,r.add=r.insert=function(t,e){var i,s;if(t._startTime=Number(e||0)+t._delay,t._paused&&this!==t._timeline&&(t._pauseTime=t._startTime+(this.rawTime()-t._startTime)/t._timeScale),t.timeline&&t.timeline._remove(t,!0),t.timeline=t._timeline=this,t._gc&&t._enabled(!0,!0),i=this._last,this._sortChildren)for(s=t._startTime;i&&i._startTime>s;)i=i._prev;return i?(t._next=i._next,i._next=t):(t._next=this._first,this._first=t),t._next?t._next._prev=t:this._last=t,t._prev=i,this._timeline&&this._uncache(!0),this},r._remove=function(t,e){return t.timeline===this&&(e||t._enabled(!1,!0),t._prev?t._prev._next=t._next:this._first===t&&(this._first=t._next),t._next?t._next._prev=t._prev:this._last===t&&(this._last=t._prev),t._next=t._prev=t.timeline=null,this._timeline&&this._uncache(!0)),this},r.render=function(t,e,i){var s,n=this._first;for(this._totalTime=this._time=this._rawPrevTime=t;n;)s=n._next,(n._active||t>=n._startTime&&!n._paused)&&(n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(t-n._startTime)*n._timeScale,e,i):n.render((t-n._startTime)*n._timeScale,e,i)),n=s},r.rawTime=function(){return o||a.wake(),this._totalTime};var I=v("TweenLite",function(e,i,s){if(C.call(this,i,s),this.render=I.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:I.selector(e)||e;var n,r,a,o=e.jquery||e.length&&e!==t&&e[0]&&(e[0]===t||e[0].nodeType&&e[0].style&&!e.nodeType),l=this.vars.overwrite;if(this._overwrite=l=null==l?Q[I.defaultOverwrite]:"number"==typeof l?l>>0:Q[l],(o||e instanceof Array||e.push&&m(e))&&"number"!=typeof e[0])for(this._targets=a=u(e),this._propLookup=[],this._siblings=[],n=0;a.length>n;n++)r=a[n],r?"string"!=typeof r?r.length&&r!==t&&r[0]&&(r[0]===t||r[0].nodeType&&r[0].style&&!r.nodeType)?(a.splice(n--,1),this._targets=a=a.concat(u(r))):(this._siblings[n]=$(r,this,!1),1===l&&this._siblings[n].length>1&&K(r,this,null,1,this._siblings[n])):(r=a[n--]=I.selector(r),"string"==typeof r&&a.splice(n+1,1)):a.splice(n--,1);else this._propLookup={},this._siblings=$(e,this,!1),1===l&&this._siblings.length>1&&K(e,this,null,1,this._siblings);(this.vars.immediateRender||0===i&&0===this._delay&&this.vars.immediateRender!==!1)&&(this._time=-_,this.render(-this._delay))},!0),E=function(e){return e.length&&e!==t&&e[0]&&(e[0]===t||e[0].nodeType&&e[0].style&&!e.nodeType)},z=function(t,e){var i,s={};for(i in t)G[i]||i in e&&"transform"!==i&&"x"!==i&&"y"!==i&&"width"!==i&&"height"!==i&&"className"!==i&&"border"!==i||!(!U[i]||U[i]&&U[i]._autoCSS)||(s[i]=t[i],delete t[i]);t.css=s};r=I.prototype=new C,r.constructor=I,r.kill()._gc=!1,r.ratio=0,r._firstPT=r._targets=r._overwrittenProps=r._startAt=null,r._notifyPluginsOfEnabled=r._lazy=!1,I.version="1.13.1",I.defaultEase=r._ease=new y(null,null,1,1),I.defaultOverwrite="auto",I.ticker=a,I.autoSleep=!0,I.lagSmoothing=function(t,e){a.lagSmoothing(t,e)},I.selector=t.$||t.jQuery||function(e){var i=t.$||t.jQuery;return i?(I.selector=i,i(e)):"undefined"==typeof document?e:document.querySelectorAll?document.querySelectorAll(e):document.getElementById("#"===e.charAt(0)?e.substr(1):e)};var O=[],L={},N=I._internals={isArray:m,isSelector:E,lazyTweens:O},U=I._plugins={},F=N.tweenLookup={},j=0,G=N.reservedProps={ease:1,delay:1,overwrite:1,onComplete:1,onCompleteParams:1,onCompleteScope:1,useFrames:1,runBackwards:1,startAt:1,onUpdate:1,onUpdateParams:1,onUpdateScope:1,onStart:1,onStartParams:1,onStartScope:1,onReverseComplete:1,onReverseCompleteParams:1,onReverseCompleteScope:1,onRepeat:1,onRepeatParams:1,onRepeatScope:1,easeParams:1,yoyo:1,immediateRender:1,repeat:1,repeatDelay:1,data:1,paused:1,reversed:1,autoCSS:1,lazy:1},Q={none:0,all:1,auto:2,concurrent:3,allOnStart:4,preexisting:5,"true":1,"false":0},q=C._rootFramesTimeline=new D,B=C._rootTimeline=new D,M=N.lazyRender=function(){var t=O.length;for(L={};--t>-1;)s=O[t],s&&s._lazy!==!1&&(s.render(s._lazy,!1,!0),s._lazy=!1);O.length=0};B._startTime=a.time,q._startTime=a.frame,B._active=q._active=!0,setTimeout(M,1),C._updateRoot=I.render=function(){var t,e,i;if(O.length&&M(),B.render((a.time-B._startTime)*B._timeScale,!1,!1),q.render((a.frame-q._startTime)*q._timeScale,!1,!1),O.length&&M(),!(a.frame%120)){for(i in F){for(e=F[i].tweens,t=e.length;--t>-1;)e[t]._gc&&e.splice(t,1);0===e.length&&delete F[i]}if(i=B._first,(!i||i._paused)&&I.autoSleep&&!q._first&&1===a._listeners.tick.length){for(;i&&i._paused;)i=i._next;i||a.sleep()}}},a.addEventListener("tick",C._updateRoot);var $=function(t,e,i){var s,n,r=t._gsTweenID;if(F[r||(t._gsTweenID=r="t"+j++)]||(F[r]={target:t,tweens:[]}),e&&(s=F[r].tweens,s[n=s.length]=e,i))for(;--n>-1;)s[n]===e&&s.splice(n,1);return F[r].tweens},K=function(t,e,i,s,n){var r,a,o,l;if(1===s||s>=4){for(l=n.length,r=0;l>r;r++)if((o=n[r])!==e)o._gc||o._enabled(!1,!1)&&(a=!0);else if(5===s)break;return a}var h,u=e._startTime+_,f=[],m=0,p=0===e._duration;for(r=n.length;--r>-1;)(o=n[r])===e||o._gc||o._paused||(o._timeline!==e._timeline?(h=h||H(e,0,p),0===H(o,h,p)&&(f[m++]=o)):u>=o._startTime&&o._startTime+o.totalDuration()/o._timeScale>u&&((p||!o._initted)&&2e-10>=u-o._startTime||(f[m++]=o)));for(r=m;--r>-1;)o=f[r],2===s&&o._kill(i,t)&&(a=!0),(2!==s||!o._firstPT&&o._initted)&&o._enabled(!1,!1)&&(a=!0);return a},H=function(t,e,i){for(var s=t._timeline,n=s._timeScale,r=t._startTime;s._timeline;){if(r+=s._startTime,n*=s._timeScale,s._paused)return-100;s=s._timeline}return r/=n,r>e?r-e:i&&r===e||!t._initted&&2*_>r-e?_:(r+=t.totalDuration()/t._timeScale/n)>e+_?0:r-e-_};r._init=function(){var t,e,i,s,n,r=this.vars,a=this._overwrittenProps,o=this._duration,l=!!r.immediateRender,h=r.ease;if(r.startAt){this._startAt&&(this._startAt.render(-1,!0),this._startAt.kill()),n={};for(s in r.startAt)n[s]=r.startAt[s];if(n.overwrite=!1,n.immediateRender=!0,n.lazy=l&&r.lazy!==!1,n.startAt=n.delay=null,this._startAt=I.to(this.target,0,n),l)if(this._time>0)this._startAt=null;else if(0!==o)return}else if(r.runBackwards&&0!==o)if(this._startAt)this._startAt.render(-1,!0),this._startAt.kill(),this._startAt=null;else{i={};for(s in r)G[s]&&"autoCSS"!==s||(i[s]=r[s]);if(i.overwrite=0,i.data="isFromStart",i.lazy=l&&r.lazy!==!1,i.immediateRender=l,this._startAt=I.to(this.target,0,i),l){if(0===this._time)return}else this._startAt._init(),this._startAt._enabled(!1)}if(this._ease=h=h?h instanceof y?h:"function"==typeof h?new y(h,r.easeParams):w[h]||I.defaultEase:I.defaultEase,r.easeParams instanceof Array&&h.config&&(this._ease=h.config.apply(h,r.easeParams)),this._easeType=this._ease._type,this._easePower=this._ease._power,this._firstPT=null,this._targets)for(t=this._targets.length;--t>-1;)this._initProps(this._targets[t],this._propLookup[t]={},this._siblings[t],a?a[t]:null)&&(e=!0);else e=this._initProps(this.target,this._propLookup,this._siblings,a);if(e&&I._onPluginEvent("_onInitAllProps",this),a&&(this._firstPT||"function"!=typeof this.target&&this._enabled(!1,!1)),r.runBackwards)for(i=this._firstPT;i;)i.s+=i.c,i.c=-i.c,i=i._next;this._onUpdate=r.onUpdate,this._initted=!0},r._initProps=function(e,i,s,n){var r,a,o,l,h,_;if(null==e)return!1;L[e._gsTweenID]&&M(),this.vars.css||e.style&&e!==t&&e.nodeType&&U.css&&this.vars.autoCSS!==!1&&z(this.vars,e);for(r in this.vars){if(_=this.vars[r],G[r])_&&(_ instanceof Array||_.push&&m(_))&&-1!==_.join("").indexOf("{self}")&&(this.vars[r]=_=this._swapSelfInParams(_,this));else if(U[r]&&(l=new U[r])._onInitTween(e,this.vars[r],this)){for(this._firstPT=h={_next:this._firstPT,t:l,p:"setRatio",s:0,c:1,f:!0,n:r,pg:!0,pr:l._priority},a=l._overwriteProps.length;--a>-1;)i[l._overwriteProps[a]]=this._firstPT;(l._priority||l._onInitAllProps)&&(o=!0),(l._onDisable||l._onEnable)&&(this._notifyPluginsOfEnabled=!0)}else this._firstPT=i[r]=h={_next:this._firstPT,t:e,p:r,f:"function"==typeof e[r],n:r,pg:!1,pr:0},h.s=h.f?e[r.indexOf("set")||"function"!=typeof e["get"+r.substr(3)]?r:"get"+r.substr(3)]():parseFloat(e[r]),h.c="string"==typeof _&&"="===_.charAt(1)?parseInt(_.charAt(0)+"1",10)*Number(_.substr(2)):Number(_)-h.s||0;h&&h._next&&(h._next._prev=h)}return n&&this._kill(n,e)?this._initProps(e,i,s,n):this._overwrite>1&&this._firstPT&&s.length>1&&K(e,this,i,this._overwrite,s)?(this._kill(i,e),this._initProps(e,i,s,n)):(this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration)&&(L[e._gsTweenID]=!0),o)},r.render=function(t,e,i){var s,n,r,a,o=this._time,l=this._duration,h=this._rawPrevTime;if(t>=l)this._totalTime=this._time=l,this.ratio=this._ease._calcEnd?this._ease.getRatio(1):1,this._reversed||(s=!0,n="onComplete"),0===l&&(this._initted||!this.vars.lazy||i)&&(this._startTime===this._timeline._duration&&(t=0),(0===t||0>h||h===_)&&h!==t&&(i=!0,h>_&&(n="onReverseComplete")),this._rawPrevTime=a=!e||t||h===t?t:_);else if(1e-7>t)this._totalTime=this._time=0,this.ratio=this._ease._calcEnd?this._ease.getRatio(0):0,(0!==o||0===l&&h>0&&h!==_)&&(n="onReverseComplete",s=this._reversed),0>t?(this._active=!1,0===l&&(this._initted||!this.vars.lazy||i)&&(h>=0&&(i=!0),this._rawPrevTime=a=!e||t||h===t?t:_)):this._initted||(i=!0);else if(this._totalTime=this._time=t,this._easeType){var u=t/l,f=this._easeType,m=this._easePower;(1===f||3===f&&u>=.5)&&(u=1-u),3===f&&(u*=2),1===m?u*=u:2===m?u*=u*u:3===m?u*=u*u*u:4===m&&(u*=u*u*u*u),this.ratio=1===f?1-u:2===f?u:.5>t/l?u/2:1-u/2}else this.ratio=this._ease.getRatio(t/l);if(this._time!==o||i){if(!this._initted){if(this._init(),!this._initted||this._gc)return;if(!i&&this._firstPT&&(this.vars.lazy!==!1&&this._duration||this.vars.lazy&&!this._duration))return this._time=this._totalTime=o,this._rawPrevTime=h,O.push(this),this._lazy=t,void 0;this._time&&!s?this.ratio=this._ease.getRatio(this._time/l):s&&this._ease._calcEnd&&(this.ratio=this._ease.getRatio(0===this._time?0:1))}for(this._lazy!==!1&&(this._lazy=!1),this._active||!this._paused&&this._time!==o&&t>=0&&(this._active=!0),0===o&&(this._startAt&&(t>=0?this._startAt.render(t,e,i):n||(n="_dummyGS")),this.vars.onStart&&(0!==this._time||0===l)&&(e||this.vars.onStart.apply(this.vars.onStartScope||this,this.vars.onStartParams||T))),r=this._firstPT;r;)r.f?r.t[r.p](r.c*this.ratio+r.s):r.t[r.p]=r.c*this.ratio+r.s,r=r._next;this._onUpdate&&(0>t&&this._startAt&&this._startTime&&this._startAt.render(t,e,i),e||(this._time!==o||s)&&this._onUpdate.apply(this.vars.onUpdateScope||this,this.vars.onUpdateParams||T)),n&&(!this._gc||i)&&(0>t&&this._startAt&&!this._onUpdate&&this._startTime&&this._startAt.render(t,e,i),s&&(this._timeline.autoRemoveChildren&&this._enabled(!1,!1),this._active=!1),!e&&this.vars[n]&&this.vars[n].apply(this.vars[n+"Scope"]||this,this.vars[n+"Params"]||T),0===l&&this._rawPrevTime===_&&a!==_&&(this._rawPrevTime=0))}},r._kill=function(t,e){if("all"===t&&(t=null),null==t&&(null==e||e===this.target))return this._lazy=!1,this._enabled(!1,!1);e="string"!=typeof e?e||this._targets||this.target:I.selector(e)||e;var i,s,n,r,a,o,l,h;if((m(e)||E(e))&&"number"!=typeof e[0])for(i=e.length;--i>-1;)this._kill(t,e[i])&&(o=!0);else{if(this._targets){for(i=this._targets.length;--i>-1;)if(e===this._targets[i]){a=this._propLookup[i]||{},this._overwrittenProps=this._overwrittenProps||[],s=this._overwrittenProps[i]=t?this._overwrittenProps[i]||{}:"all";break}}else{if(e!==this.target)return!1;a=this._propLookup,s=this._overwrittenProps=t?this._overwrittenProps||{}:"all"}if(a){l=t||a,h=t!==s&&"all"!==s&&t!==a&&("object"!=typeof t||!t._tempKill);for(n in l)(r=a[n])&&(r.pg&&r.t._kill(l)&&(o=!0),r.pg&&0!==r.t._overwriteProps.length||(r._prev?r._prev._next=r._next:r===this._firstPT&&(this._firstPT=r._next),r._next&&(r._next._prev=r._prev),r._next=r._prev=null),delete a[n]),h&&(s[n]=1);!this._firstPT&&this._initted&&this._enabled(!1,!1)}}return o},r.invalidate=function(){return this._notifyPluginsOfEnabled&&I._onPluginEvent("_onDisable",this),this._firstPT=null,this._overwrittenProps=null,this._onUpdate=null,this._startAt=null,this._initted=this._active=this._notifyPluginsOfEnabled=this._lazy=!1,this._propLookup=this._targets?{}:[],this},r._enabled=function(t,e){if(o||a.wake(),t&&this._gc){var i,s=this._targets;if(s)for(i=s.length;--i>-1;)this._siblings[i]=$(s[i],this,!0);else this._siblings=$(this.target,this,!0)}return C.prototype._enabled.call(this,t,e),this._notifyPluginsOfEnabled&&this._firstPT?I._onPluginEvent(t?"_onEnable":"_onDisable",this):!1},I.to=function(t,e,i){return new I(t,e,i)},I.from=function(t,e,i){return i.runBackwards=!0,i.immediateRender=0!=i.immediateRender,new I(t,e,i)},I.fromTo=function(t,e,i,s){return s.startAt=i,s.immediateRender=0!=s.immediateRender&&0!=i.immediateRender,new I(t,e,s)},I.delayedCall=function(t,e,i,s,n){return new I(e,0,{delay:t,onComplete:e,onCompleteParams:i,onCompleteScope:s,onReverseComplete:e,onReverseCompleteParams:i,onReverseCompleteScope:s,immediateRender:!1,useFrames:n,overwrite:0})},I.set=function(t,e){return new I(t,0,e)},I.getTweensOf=function(t,e){if(null==t)return[];t="string"!=typeof t?t:I.selector(t)||t;var i,s,n,r;if((m(t)||E(t))&&"number"!=typeof t[0]){for(i=t.length,s=[];--i>-1;)s=s.concat(I.getTweensOf(t[i],e));for(i=s.length;--i>-1;)for(r=s[i],n=i;--n>-1;)r===s[n]&&s.splice(i,1)}else for(s=$(t).concat(),i=s.length;--i>-1;)(s[i]._gc||e&&!s[i].isActive())&&s.splice(i,1);return s},I.killTweensOf=I.killDelayedCallsTo=function(t,e,i){"object"==typeof e&&(i=e,e=!1);for(var s=I.getTweensOf(t,e),n=s.length;--n>-1;)s[n]._kill(i,t)};var J=v("plugins.TweenPlugin",function(t,e){this._overwriteProps=(t||"").split(","),this._propName=this._overwriteProps[0],this._priority=e||0,this._super=J.prototype},!0);if(r=J.prototype,J.version="1.10.1",J.API=2,r._firstPT=null,r._addTween=function(t,e,i,s,n,r){var a,o;return null!=s&&(a="number"==typeof s||"="!==s.charAt(1)?Number(s)-i:parseInt(s.charAt(0)+"1",10)*Number(s.substr(2)))?(this._firstPT=o={_next:this._firstPT,t:t,p:e,s:i,c:a,f:"function"==typeof t[e],n:n||e,r:r},o._next&&(o._next._prev=o),o):void 0},r.setRatio=function(t){for(var e,i=this._firstPT,s=1e-6;i;)e=i.c*t+i.s,i.r?e=Math.round(e):s>e&&e>-s&&(e=0),i.f?i.t[i.p](e):i.t[i.p]=e,i=i._next},r._kill=function(t){var e,i=this._overwriteProps,s=this._firstPT;if(null!=t[this._propName])this._overwriteProps=[];else for(e=i.length;--e>-1;)null!=t[i[e]]&&i.splice(e,1);for(;s;)null!=t[s.n]&&(s._next&&(s._next._prev=s._prev),s._prev?(s._prev._next=s._next,s._prev=null):this._firstPT===s&&(this._firstPT=s._next)),s=s._next;return!1},r._roundProps=function(t,e){for(var i=this._firstPT;i;)(t[this._propName]||null!=i.n&&t[i.n.split(this._propName+"_").join("")])&&(i.r=e),i=i._next},I._onPluginEvent=function(t,e){var i,s,n,r,a,o=e._firstPT;if("_onInitAllProps"===t){for(;o;){for(a=o._next,s=n;s&&s.pr>o.pr;)s=s._next;(o._prev=s?s._prev:r)?o._prev._next=o:n=o,(o._next=s)?s._prev=o:r=o,o=a}o=e._firstPT=n}for(;o;)o.pg&&"function"==typeof o.t[t]&&o.t[t]()&&(i=!0),o=o._next;return i},J.activate=function(t){for(var e=t.length;--e>-1;)t[e].API===J.API&&(U[(new t[e])._propName]=t[e]);return!0},d.plugin=function(t){if(!(t&&t.propName&&t.init&&t.API))throw"illegal plugin definition.";var e,i=t.propName,s=t.priority||0,n=t.overwriteProps,r={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_roundProps",initAll:"_onInitAllProps"},a=v("plugins."+i.charAt(0).toUpperCase()+i.substr(1)+"Plugin",function(){J.call(this,i,s),this._overwriteProps=n||[]},t.global===!0),o=a.prototype=new J(i);o.constructor=a,a.API=t.API;for(e in r)"function"==typeof t[e]&&(o[r[e]]=t[e]);return a.version=t.version,J.activate([a]),a},s=t._gsQueue){for(n=0;s.length>n;n++)s[n]();for(r in p)p[r].func||t.console.log("GSAP encountered missing dependency: com.greensock."+r)}o=!1}})("undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window,"TweenLite");
\ No newline at end of file
diff --git a/public/js/v1.2.4/lib/blueimp-gallery.js b/public/js/v1.2.4/lib/blueimp-gallery.js
new file mode 100644
index 00000000..b95cf470
--- /dev/null
+++ b/public/js/v1.2.4/lib/blueimp-gallery.js
@@ -0,0 +1,1377 @@
+/*
+ * blueimp Gallery JS
+ * https://github.com/blueimp/Gallery
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Swipe implementation based on
+ * https://github.com/bradbirdsall/Swipe
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* global define, window, document, DocumentTouch */
+
+;(function (factory) {
+ 'use strict'
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['blueImpGalleryHelper'], factory)
+ } else {
+ // Browser globals:
+ window.blueimp = window.blueimp || {}
+ window.blueimp.Gallery = factory(
+ window.blueimp.helper || window.jQuery
+ )
+ }
+}(function ($) {
+ 'use strict'
+
+ function Gallery (list, options) {
+ if (document.body.style.maxHeight === undefined) {
+ // document.body.style.maxHeight is undefined on IE6 and lower
+ return null
+ }
+ if (!this || this.options !== Gallery.prototype.options) {
+ // Called as function instead of as constructor,
+ // so we simply return a new instance:
+ return new Gallery(list, options)
+ }
+ if (!list || !list.length) {
+ this.console.log(
+ 'blueimp Gallery: No or empty list provided as first argument.',
+ list
+ )
+ return
+ }
+ this.list = list
+ this.num = list.length
+ this.initOptions(options)
+ this.initialize()
+ }
+
+ $.extend(Gallery.prototype, {
+ options: {
+ // The Id, element or querySelector of the gallery widget:
+ container: '#blueimp-gallery',
+ // The tag name, Id, element or querySelector of the slides container:
+ slidesContainer: 'div',
+ // The tag name, Id, element or querySelector of the title element:
+ titleElement: 'h3',
+ // The class to add when the gallery is visible:
+ displayClass: 'blueimp-gallery-display',
+ // The class to add when the gallery controls are visible:
+ controlsClass: 'blueimp-gallery-controls',
+ // The class to add when the gallery only displays one element:
+ singleClass: 'blueimp-gallery-single',
+ // The class to add when the left edge has been reached:
+ leftEdgeClass: 'blueimp-gallery-left',
+ // The class to add when the right edge has been reached:
+ rightEdgeClass: 'blueimp-gallery-right',
+ // The class to add when the automatic slideshow is active:
+ playingClass: 'blueimp-gallery-playing',
+ // The class for all slides:
+ slideClass: 'slide',
+ // The slide class for loading elements:
+ slideLoadingClass: 'slide-loading',
+ // The slide class for elements that failed to load:
+ slideErrorClass: 'slide-error',
+ // The class for the content element loaded into each slide:
+ slideContentClass: 'slide-content',
+ // The class for the "toggle" control:
+ toggleClass: 'toggle',
+ // The class for the "prev" control:
+ prevClass: 'prev',
+ // The class for the "next" control:
+ nextClass: 'next',
+ // The class for the "close" control:
+ closeClass: 'close',
+ // The class for the "play-pause" toggle control:
+ playPauseClass: 'play-pause',
+ // The list object property (or data attribute) with the object type:
+ typeProperty: 'type',
+ // The list object property (or data attribute) with the object title:
+ titleProperty: 'title',
+ // The list object property (or data attribute) with the object URL:
+ urlProperty: 'href',
+ // The list object property (or data attribute) with the object srcset URL(s):
+ srcsetProperty: 'urlset',
+ // The gallery listens for transitionend events before triggering the
+ // opened and closed events, unless the following option is set to false:
+ displayTransition: true,
+ // Defines if the gallery slides are cleared from the gallery modal,
+ // or reused for the next gallery initialization:
+ clearSlides: true,
+ // Defines if images should be stretched to fill the available space,
+ // while maintaining their aspect ratio (will only be enabled for browsers
+ // supporting background-size="contain", which excludes IE < 9).
+ // Set to "cover", to make images cover all available space (requires
+ // support for background-size="cover", which excludes IE < 9):
+ stretchImages: false,
+ // Toggle the controls on pressing the Return key:
+ toggleControlsOnReturn: true,
+ // Toggle the controls on slide click:
+ toggleControlsOnSlideClick: true,
+ // Toggle the automatic slideshow interval on pressing the Space key:
+ toggleSlideshowOnSpace: true,
+ // Navigate the gallery by pressing left and right on the keyboard:
+ enableKeyboardNavigation: true,
+ // Close the gallery on pressing the Esc key:
+ closeOnEscape: true,
+ // Close the gallery when clicking on an empty slide area:
+ closeOnSlideClick: true,
+ // Close the gallery by swiping up or down:
+ closeOnSwipeUpOrDown: true,
+ // Emulate touch events on mouse-pointer devices such as desktop browsers:
+ emulateTouchEvents: true,
+ // Stop touch events from bubbling up to ancestor elements of the Gallery:
+ stopTouchEventsPropagation: false,
+ // Hide the page scrollbars:
+ hidePageScrollbars: true,
+ // Stops any touches on the container from scrolling the page:
+ disableScroll: true,
+ // Carousel mode (shortcut for carousel specific options):
+ carousel: false,
+ // Allow continuous navigation, moving from last to first
+ // and from first to last slide:
+ continuous: true,
+ // Remove elements outside of the preload range from the DOM:
+ unloadElements: true,
+ // Start with the automatic slideshow:
+ startSlideshow: false,
+ // Delay in milliseconds between slides for the automatic slideshow:
+ slideshowInterval: 5000,
+ // The starting index as integer.
+ // Can also be an object of the given list,
+ // or an equal object with the same url property:
+ index: 0,
+ // The number of elements to load around the current index:
+ preloadRange: 2,
+ // The transition speed between slide changes in milliseconds:
+ transitionSpeed: 400,
+ // The transition speed for automatic slide changes, set to an integer
+ // greater 0 to override the default transition speed:
+ slideshowTransitionSpeed: undefined,
+ // The event object for which the default action will be canceled
+ // on Gallery initialization (e.g. the click event to open the Gallery):
+ event: undefined,
+ // Callback function executed when the Gallery is initialized.
+ // Is called with the gallery instance as "this" object:
+ onopen: undefined,
+ // Callback function executed when the Gallery has been initialized
+ // and the initialization transition has been completed.
+ // Is called with the gallery instance as "this" object:
+ onopened: undefined,
+ // Callback function executed on slide change.
+ // Is called with the gallery instance as "this" object and the
+ // current index and slide as arguments:
+ onslide: undefined,
+ // Callback function executed after the slide change transition.
+ // Is called with the gallery instance as "this" object and the
+ // current index and slide as arguments:
+ onslideend: undefined,
+ // Callback function executed on slide content load.
+ // Is called with the gallery instance as "this" object and the
+ // slide index and slide element as arguments:
+ onslidecomplete: undefined,
+ // Callback function executed when the Gallery is about to be closed.
+ // Is called with the gallery instance as "this" object:
+ onclose: undefined,
+ // Callback function executed when the Gallery has been closed
+ // and the closing transition has been completed.
+ // Is called with the gallery instance as "this" object:
+ onclosed: undefined
+ },
+
+ carouselOptions: {
+ hidePageScrollbars: false,
+ toggleControlsOnReturn: false,
+ toggleSlideshowOnSpace: false,
+ enableKeyboardNavigation: false,
+ closeOnEscape: false,
+ closeOnSlideClick: false,
+ closeOnSwipeUpOrDown: false,
+ disableScroll: false,
+ startSlideshow: true
+ },
+
+ console: window.console && typeof window.console.log === 'function'
+ ? window.console
+ : {log: function () {}},
+
+ // Detect touch, transition, transform and background-size support:
+ support: (function (element) {
+ var support = {
+ touch: window.ontouchstart !== undefined ||
+ (window.DocumentTouch && document instanceof DocumentTouch)
+ }
+ var transitions = {
+ webkitTransition: {
+ end: 'webkitTransitionEnd',
+ prefix: '-webkit-'
+ },
+ MozTransition: {
+ end: 'transitionend',
+ prefix: '-moz-'
+ },
+ OTransition: {
+ end: 'otransitionend',
+ prefix: '-o-'
+ },
+ transition: {
+ end: 'transitionend',
+ prefix: ''
+ }
+ }
+ var prop
+ for (prop in transitions) {
+ if (transitions.hasOwnProperty(prop) &&
+ element.style[prop] !== undefined) {
+ support.transition = transitions[prop]
+ support.transition.name = prop
+ break
+ }
+ }
+ function elementTests () {
+ var transition = support.transition
+ var prop
+ var translateZ
+ document.body.appendChild(element)
+ if (transition) {
+ prop = transition.name.slice(0, -9) + 'ransform'
+ if (element.style[prop] !== undefined) {
+ element.style[prop] = 'translateZ(0)'
+ translateZ = window.getComputedStyle(element)
+ .getPropertyValue(transition.prefix + 'transform')
+ support.transform = {
+ prefix: transition.prefix,
+ name: prop,
+ translate: true,
+ translateZ: !!translateZ && translateZ !== 'none'
+ }
+ }
+ }
+ if (element.style.backgroundSize !== undefined) {
+ support.backgroundSize = {}
+ element.style.backgroundSize = 'contain'
+ support.backgroundSize.contain = window
+ .getComputedStyle(element)
+ .getPropertyValue('background-size') === 'contain'
+ element.style.backgroundSize = 'cover'
+ support.backgroundSize.cover = window
+ .getComputedStyle(element)
+ .getPropertyValue('background-size') === 'cover'
+ }
+ document.body.removeChild(element)
+ }
+ if (document.body) {
+ elementTests()
+ } else {
+ $(document).on('DOMContentLoaded', elementTests)
+ }
+ return support
+ // Test element, has to be standard HTML and must not be hidden
+ // for the CSS3 tests using window.getComputedStyle to be applicable:
+ }(document.createElement('div'))),
+
+ requestAnimationFrame: window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame,
+
+ initialize: function () {
+ this.initStartIndex()
+ if (this.initWidget() === false) {
+ return false
+ }
+ this.initEventListeners()
+ // Load the slide at the given index:
+ this.onslide(this.index)
+ // Manually trigger the slideend event for the initial slide:
+ this.ontransitionend()
+ // Start the automatic slideshow if applicable:
+ if (this.options.startSlideshow) {
+ this.play()
+ }
+ },
+
+ slide: function (to, speed) {
+ window.clearTimeout(this.timeout)
+ var index = this.index
+ var direction
+ var naturalDirection
+ var diff
+ if (index === to || this.num === 1) {
+ return
+ }
+ if (!speed) {
+ speed = this.options.transitionSpeed
+ }
+ if (this.support.transform) {
+ if (!this.options.continuous) {
+ to = this.circle(to)
+ }
+ // 1: backward, -1: forward:
+ direction = Math.abs(index - to) / (index - to)
+ // Get the actual position of the slide:
+ if (this.options.continuous) {
+ naturalDirection = direction
+ direction = -this.positions[this.circle(to)] / this.slideWidth
+ // If going forward but to < index, use to = slides.length + to
+ // If going backward but to > index, use to = -slides.length + to
+ if (direction !== naturalDirection) {
+ to = -direction * this.num + to
+ }
+ }
+ diff = Math.abs(index - to) - 1
+ // Move all the slides between index and to in the right direction:
+ while (diff) {
+ diff -= 1
+ this.move(
+ this.circle((to > index ? to : index) - diff - 1),
+ this.slideWidth * direction,
+ 0
+ )
+ }
+ to = this.circle(to)
+ this.move(index, this.slideWidth * direction, speed)
+ this.move(to, 0, speed)
+ if (this.options.continuous) {
+ this.move(
+ this.circle(to - direction),
+ -(this.slideWidth * direction),
+ 0
+ )
+ }
+ } else {
+ to = this.circle(to)
+ this.animate(index * -this.slideWidth, to * -this.slideWidth, speed)
+ }
+ this.onslide(to)
+ },
+
+ getIndex: function () {
+ return this.index
+ },
+
+ getNumber: function () {
+ return this.num
+ },
+
+ prev: function () {
+ if (this.options.continuous || this.index) {
+ this.slide(this.index - 1)
+ }
+ },
+
+ next: function () {
+ if (this.options.continuous || this.index < this.num - 1) {
+ this.slide(this.index + 1)
+ }
+ },
+
+ play: function (time) {
+ var that = this
+ window.clearTimeout(this.timeout)
+ this.interval = time || this.options.slideshowInterval
+ if (this.elements[this.index] > 1) {
+ this.timeout = this.setTimeout(
+ (!this.requestAnimationFrame && this.slide) || function (to, speed) {
+ that.animationFrameId = that.requestAnimationFrame.call(
+ window,
+ function () {
+ that.slide(to, speed)
+ }
+ )
+ },
+ [this.index + 1, this.options.slideshowTransitionSpeed],
+ this.interval
+ )
+ }
+ this.container.addClass(this.options.playingClass)
+ },
+
+ pause: function () {
+ window.clearTimeout(this.timeout)
+ this.interval = null
+ this.container.removeClass(this.options.playingClass)
+ },
+
+ add: function (list) {
+ var i
+ if (!list.concat) {
+ // Make a real array out of the list to add:
+ list = Array.prototype.slice.call(list)
+ }
+ if (!this.list.concat) {
+ // Make a real array out of the Gallery list:
+ this.list = Array.prototype.slice.call(this.list)
+ }
+ this.list = this.list.concat(list)
+ this.num = this.list.length
+ if (this.num > 2 && this.options.continuous === null) {
+ this.options.continuous = true
+ this.container.removeClass(this.options.leftEdgeClass)
+ }
+ this.container
+ .removeClass(this.options.rightEdgeClass)
+ .removeClass(this.options.singleClass)
+ for (i = this.num - list.length; i < this.num; i += 1) {
+ this.addSlide(i)
+ this.positionSlide(i)
+ }
+ this.positions.length = this.num
+ this.initSlides(true)
+ },
+
+ resetSlides: function () {
+ this.slidesContainer.empty()
+ this.unloadAllSlides()
+ this.slides = []
+ },
+
+ handleClose: function () {
+ var options = this.options
+ this.destroyEventListeners()
+ // Cancel the slideshow:
+ this.pause()
+ this.container[0].style.display = 'none'
+ this.container
+ .removeClass(options.displayClass)
+ .removeClass(options.singleClass)
+ .removeClass(options.leftEdgeClass)
+ .removeClass(options.rightEdgeClass)
+ if (options.hidePageScrollbars) {
+ document.body.style.overflow = this.bodyOverflowStyle
+ }
+ if (this.options.clearSlides) {
+ this.resetSlides()
+ }
+ if (this.options.onclosed) {
+ this.options.onclosed.call(this)
+ }
+ },
+
+ close: function () {
+ var that = this
+ function closeHandler (event) {
+ if (event.target === that.container[0]) {
+ that.container.off(
+ that.support.transition.end,
+ closeHandler
+ )
+ that.handleClose()
+ }
+ }
+ if (this.options.onclose) {
+ this.options.onclose.call(this)
+ }
+ if (this.support.transition && this.options.displayTransition) {
+ this.container.on(
+ this.support.transition.end,
+ closeHandler
+ )
+ this.container.removeClass(this.options.displayClass)
+ } else {
+ this.handleClose()
+ }
+ },
+
+ circle: function (index) {
+ // Always return a number inside of the slides index range:
+ return (this.num + (index % this.num)) % this.num
+ },
+
+ move: function (index, dist, speed) {
+ this.translateX(index, dist, speed)
+ this.positions[index] = dist
+ },
+
+ translate: function (index, x, y, speed) {
+ var style = this.slides[index].style
+ var transition = this.support.transition
+ var transform = this.support.transform
+ style[transition.name + 'Duration'] = speed + 'ms'
+ style[transform.name] = 'translate(' + x + 'px, ' + y + 'px)' +
+ (transform.translateZ ? ' translateZ(0)' : '')
+ },
+
+ translateX: function (index, x, speed) {
+ this.translate(index, x, 0, speed)
+ },
+
+ translateY: function (index, y, speed) {
+ this.translate(index, 0, y, speed)
+ },
+
+ animate: function (from, to, speed) {
+ if (!speed) {
+ this.slidesContainer[0].style.left = to + 'px'
+ return
+ }
+ var that = this
+ var start = new Date().getTime()
+ var timer = window.setInterval(function () {
+ var timeElap = new Date().getTime() - start
+ if (timeElap > speed) {
+ that.slidesContainer[0].style.left = to + 'px'
+ that.ontransitionend()
+ window.clearInterval(timer)
+ return
+ }
+ that.slidesContainer[0].style.left = (((to - from) *
+ (Math.floor((timeElap / speed) * 100) / 100)) +
+ from) + 'px'
+ }, 4)
+ },
+
+ preventDefault: function (event) {
+ if (event.preventDefault) {
+ event.preventDefault()
+ } else {
+ event.returnValue = false
+ }
+ },
+
+ stopPropagation: function (event) {
+ if (event.stopPropagation) {
+ event.stopPropagation()
+ } else {
+ event.cancelBubble = true
+ }
+ },
+
+ onresize: function () {
+ this.initSlides(true)
+ },
+
+ onmousedown: function (event) {
+ // Trigger on clicks of the left mouse button only
+ // and exclude video elements:
+ if (event.which && event.which === 1 &&
+ event.target.nodeName !== 'VIDEO') {
+ // Preventing the default mousedown action is required
+ // to make touch emulation work with Firefox:
+ event.preventDefault()
+ ;(event.originalEvent || event).touches = [{
+ pageX: event.pageX,
+ pageY: event.pageY
+ }]
+ this.ontouchstart(event)
+ }
+ },
+
+ onmousemove: function (event) {
+ if (this.touchStart) {
+ (event.originalEvent || event).touches = [{
+ pageX: event.pageX,
+ pageY: event.pageY
+ }]
+ this.ontouchmove(event)
+ }
+ },
+
+ onmouseup: function (event) {
+ if (this.touchStart) {
+ this.ontouchend(event)
+ delete this.touchStart
+ }
+ },
+
+ onmouseout: function (event) {
+ if (this.touchStart) {
+ var target = event.target
+ var related = event.relatedTarget
+ if (!related || (related !== target &&
+ !$.contains(target, related))) {
+ this.onmouseup(event)
+ }
+ }
+ },
+
+ ontouchstart: function (event) {
+ if (this.options.stopTouchEventsPropagation) {
+ this.stopPropagation(event)
+ }
+ // jQuery doesn't copy touch event properties by default,
+ // so we have to access the originalEvent object:
+ var touches = (event.originalEvent || event).touches[0]
+ this.touchStart = {
+ // Remember the initial touch coordinates:
+ x: touches.pageX,
+ y: touches.pageY,
+ // Store the time to determine touch duration:
+ time: Date.now()
+ }
+ // Helper variable to detect scroll movement:
+ this.isScrolling = undefined
+ // Reset delta values:
+ this.touchDelta = {}
+ },
+
+ ontouchmove: function (event) {
+ if (this.options.stopTouchEventsPropagation) {
+ this.stopPropagation(event)
+ }
+ // jQuery doesn't copy touch event properties by default,
+ // so we have to access the originalEvent object:
+ var touches = (event.originalEvent || event).touches[0]
+ var scale = (event.originalEvent || event).scale
+ var index = this.index
+ var touchDeltaX
+ var indices
+ // Ensure this is a one touch swipe and not, e.g. a pinch:
+ if (touches.length > 1 || (scale && scale !== 1)) {
+ return
+ }
+ if (this.options.disableScroll) {
+ event.preventDefault()
+ }
+ // Measure change in x and y coordinates:
+ this.touchDelta = {
+ x: touches.pageX - this.touchStart.x,
+ y: touches.pageY - this.touchStart.y
+ }
+ touchDeltaX = this.touchDelta.x
+ // Detect if this is a vertical scroll movement (run only once per touch):
+ if (this.isScrolling === undefined) {
+ this.isScrolling = this.isScrolling ||
+ Math.abs(touchDeltaX) < Math.abs(this.touchDelta.y)
+ }
+ if (!this.isScrolling) {
+ // Always prevent horizontal scroll:
+ event.preventDefault()
+ // Stop the slideshow:
+ window.clearTimeout(this.timeout)
+ if (this.options.continuous) {
+ indices = [
+ this.circle(index + 1),
+ index,
+ this.circle(index - 1)
+ ]
+ } else {
+ // Increase resistance if first slide and sliding left
+ // or last slide and sliding right:
+ this.touchDelta.x = touchDeltaX =
+ touchDeltaX /
+ (
+ ((!index && touchDeltaX > 0) ||
+ (index === this.num - 1 && touchDeltaX < 0))
+ ? (Math.abs(touchDeltaX) / this.slideWidth + 1)
+ : 1
+ )
+ indices = [index]
+ if (index) {
+ indices.push(index - 1)
+ }
+ if (index < this.num - 1) {
+ indices.unshift(index + 1)
+ }
+ }
+ while (indices.length) {
+ index = indices.pop()
+ this.translateX(index, touchDeltaX + this.positions[index], 0)
+ }
+ } else if (this.options.closeOnSwipeUpOrDown) {
+ this.translateY(index, this.touchDelta.y + this.positions[index], 0)
+ }
+ },
+
+ ontouchend: function (event) {
+ if (this.options.stopTouchEventsPropagation) {
+ this.stopPropagation(event)
+ }
+ var index = this.index
+ var speed = this.options.transitionSpeed
+ var slideWidth = this.slideWidth
+ var isShortDuration = Number(Date.now() - this.touchStart.time) < 250
+ // Determine if slide attempt triggers next/prev slide:
+ var isValidSlide =
+ (isShortDuration && Math.abs(this.touchDelta.x) > 20) ||
+ Math.abs(this.touchDelta.x) > slideWidth / 2
+ // Determine if slide attempt is past start or end:
+ var isPastBounds = (!index && this.touchDelta.x > 0) ||
+ (index === this.num - 1 && this.touchDelta.x < 0)
+ var isValidClose = !isValidSlide && this.options.closeOnSwipeUpOrDown &&
+ ((isShortDuration && Math.abs(this.touchDelta.y) > 20) ||
+ Math.abs(this.touchDelta.y) > this.slideHeight / 2)
+ var direction
+ var indexForward
+ var indexBackward
+ var distanceForward
+ var distanceBackward
+ if (this.options.continuous) {
+ isPastBounds = false
+ }
+ // Determine direction of swipe (true: right, false: left):
+ direction = this.touchDelta.x < 0 ? -1 : 1
+ if (!this.isScrolling) {
+ if (isValidSlide && !isPastBounds) {
+ indexForward = index + direction
+ indexBackward = index - direction
+ distanceForward = slideWidth * direction
+ distanceBackward = -slideWidth * direction
+ if (this.options.continuous) {
+ this.move(this.circle(indexForward), distanceForward, 0)
+ this.move(this.circle(index - 2 * direction), distanceBackward, 0)
+ } else if (indexForward >= 0 &&
+ indexForward < this.num) {
+ this.move(indexForward, distanceForward, 0)
+ }
+ this.move(index, this.positions[index] + distanceForward, speed)
+ this.move(
+ this.circle(indexBackward),
+ this.positions[this.circle(indexBackward)] + distanceForward,
+ speed
+ )
+ index = this.circle(indexBackward)
+ this.onslide(index)
+ } else {
+ // Move back into position
+ if (this.options.continuous) {
+ this.move(this.circle(index - 1), -slideWidth, speed)
+ this.move(index, 0, speed)
+ this.move(this.circle(index + 1), slideWidth, speed)
+ } else {
+ if (index) {
+ this.move(index - 1, -slideWidth, speed)
+ }
+ this.move(index, 0, speed)
+ if (index < this.num - 1) {
+ this.move(index + 1, slideWidth, speed)
+ }
+ }
+ }
+ } else {
+ if (isValidClose) {
+ this.close()
+ } else {
+ // Move back into position
+ this.translateY(index, 0, speed)
+ }
+ }
+ },
+
+ ontouchcancel: function (event) {
+ if (this.touchStart) {
+ this.ontouchend(event)
+ delete this.touchStart
+ }
+ },
+
+ ontransitionend: function (event) {
+ var slide = this.slides[this.index]
+ if (!event || slide === event.target) {
+ if (this.interval) {
+ this.play()
+ }
+ this.setTimeout(
+ this.options.onslideend,
+ [this.index, slide]
+ )
+ }
+ },
+
+ oncomplete: function (event) {
+ var target = event.target || event.srcElement
+ var parent = target && target.parentNode
+ var index
+ if (!target || !parent) {
+ return
+ }
+ index = this.getNodeIndex(parent)
+ $(parent).removeClass(this.options.slideLoadingClass)
+ if (event.type === 'error') {
+ $(parent).addClass(this.options.slideErrorClass)
+ this.elements[index] = 3 // Fail
+ } else {
+ this.elements[index] = 2 // Done
+ }
+ // Fix for IE7's lack of support for percentage max-height:
+ if (target.clientHeight > this.container[0].clientHeight) {
+ target.style.maxHeight = this.container[0].clientHeight
+ }
+ if (this.interval && this.slides[this.index] === parent) {
+ this.play()
+ }
+ this.setTimeout(
+ this.options.onslidecomplete,
+ [index, parent]
+ )
+ },
+
+ onload: function (event) {
+ this.oncomplete(event)
+ },
+
+ onerror: function (event) {
+ this.oncomplete(event)
+ },
+
+ onkeydown: function (event) {
+ switch (event.which || event.keyCode) {
+ case 13: // Return
+ if (this.options.toggleControlsOnReturn) {
+ this.preventDefault(event)
+ this.toggleControls()
+ }
+ break
+ case 27: // Esc
+ if (this.options.closeOnEscape) {
+ this.close()
+ // prevent Esc from closing other things
+ event.stopImmediatePropagation()
+ }
+ break
+ case 32: // Space
+ if (this.options.toggleSlideshowOnSpace) {
+ this.preventDefault(event)
+ this.toggleSlideshow()
+ }
+ break
+ case 37: // Left
+ if (this.options.enableKeyboardNavigation) {
+ this.preventDefault(event)
+ this.prev()
+ }
+ break
+ case 39: // Right
+ if (this.options.enableKeyboardNavigation) {
+ this.preventDefault(event)
+ this.next()
+ }
+ break
+ }
+ },
+
+ handleClick: function (event) {
+ var options = this.options
+ var target = event.target || event.srcElement
+ var parent = target.parentNode
+ function isTarget (className) {
+ return $(target).hasClass(className) ||
+ $(parent).hasClass(className)
+ }
+ if (isTarget(options.toggleClass)) {
+ // Click on "toggle" control
+ this.preventDefault(event)
+ this.toggleControls()
+ } else if (isTarget(options.prevClass)) {
+ // Click on "prev" control
+ this.preventDefault(event)
+ this.prev()
+ } else if (isTarget(options.nextClass)) {
+ // Click on "next" control
+ this.preventDefault(event)
+ this.next()
+ } else if (isTarget(options.closeClass)) {
+ // Click on "close" control
+ this.preventDefault(event)
+ this.close()
+ } else if (isTarget(options.playPauseClass)) {
+ // Click on "play-pause" control
+ this.preventDefault(event)
+ this.toggleSlideshow()
+ } else if (parent === this.slidesContainer[0]) {
+ // Click on slide background
+ if (options.closeOnSlideClick) {
+ this.preventDefault(event)
+ this.close()
+ } else if (options.toggleControlsOnSlideClick) {
+ this.preventDefault(event)
+ this.toggleControls()
+ }
+ } else if (parent.parentNode &&
+ parent.parentNode === this.slidesContainer[0]) {
+ // Click on displayed element
+ if (options.toggleControlsOnSlideClick) {
+ this.preventDefault(event)
+ this.toggleControls()
+ }
+ }
+ },
+
+ onclick: function (event) {
+ if (this.options.emulateTouchEvents &&
+ this.touchDelta && (Math.abs(this.touchDelta.x) > 20 ||
+ Math.abs(this.touchDelta.y) > 20)) {
+ delete this.touchDelta
+ return
+ }
+ return this.handleClick(event)
+ },
+
+ updateEdgeClasses: function (index) {
+ if (!index) {
+ this.container.addClass(this.options.leftEdgeClass)
+ } else {
+ this.container.removeClass(this.options.leftEdgeClass)
+ }
+ if (index === this.num - 1) {
+ this.container.addClass(this.options.rightEdgeClass)
+ } else {
+ this.container.removeClass(this.options.rightEdgeClass)
+ }
+ },
+
+ handleSlide: function (index) {
+ if (!this.options.continuous) {
+ this.updateEdgeClasses(index)
+ }
+ this.loadElements(index)
+ if (this.options.unloadElements) {
+ this.unloadElements(index)
+ }
+ this.setTitle(index)
+ },
+
+ onslide: function (index) {
+ this.index = index
+ this.handleSlide(index)
+ this.setTimeout(this.options.onslide, [index, this.slides[index]])
+ },
+
+ setTitle: function (index) {
+ var text = this.slides[index].firstChild.title
+ var titleElement = this.titleElement
+ if (titleElement.length) {
+ this.titleElement.empty()
+ if (text) {
+ titleElement[0].appendChild(document.createTextNode(text))
+ }
+ }
+ },
+
+ setTimeout: function (func, args, wait) {
+ var that = this
+ return func && window.setTimeout(function () {
+ func.apply(that, args || [])
+ }, wait || 0)
+ },
+
+ imageFactory: function (obj, callback) {
+ var that = this
+ var img = this.imagePrototype.cloneNode(false)
+ var url = obj
+ var backgroundSize = this.options.stretchImages
+ var called
+ var element
+ var title
+ function callbackWrapper (event) {
+ if (!called) {
+ event = {
+ type: event.type,
+ target: element
+ }
+ if (!element.parentNode) {
+ // Fix for IE7 firing the load event for
+ // cached images before the element could
+ // be added to the DOM:
+ return that.setTimeout(callbackWrapper, [event])
+ }
+ called = true
+ $(img).off('load error', callbackWrapper)
+ if (backgroundSize) {
+ if (event.type === 'load') {
+ element.style.background = 'url("' + url +
+ '") center no-repeat'
+ element.style.backgroundSize = backgroundSize
+ }
+ }
+ callback(event)
+ }
+ }
+ if (typeof url !== 'string') {
+ url = this.getItemProperty(obj, this.options.urlProperty)
+ title = this.getItemProperty(obj, this.options.titleProperty)
+ }
+ if (backgroundSize === true) {
+ backgroundSize = 'contain'
+ }
+ backgroundSize = this.support.backgroundSize &&
+ this.support.backgroundSize[backgroundSize] && backgroundSize
+ if (backgroundSize) {
+ element = this.elementPrototype.cloneNode(false)
+ } else {
+ element = img
+ img.draggable = false
+ }
+ if (title) {
+ element.title = title
+ }
+ $(img).on('load error', callbackWrapper)
+ img.src = url
+ return element
+ },
+
+ createElement: function (obj, callback) {
+ var type = obj && this.getItemProperty(obj, this.options.typeProperty)
+ var factory = (type && this[type.split('/')[0] + 'Factory']) ||
+ this.imageFactory
+ var element = obj && factory.call(this, obj, callback)
+ var srcset = this.getItemProperty(obj, this.options.srcsetProperty)
+ if (!element) {
+ element = this.elementPrototype.cloneNode(false)
+ this.setTimeout(callback, [{
+ type: 'error',
+ target: element
+ }])
+ }
+ if (srcset) {
+ element.setAttribute('srcset', srcset)
+ }
+ $(element).addClass(this.options.slideContentClass)
+ return element
+ },
+
+ loadElement: function (index) {
+ if (!this.elements[index]) {
+ if (this.slides[index].firstChild) {
+ this.elements[index] = $(this.slides[index])
+ .hasClass(this.options.slideErrorClass) ? 3 : 2
+ } else {
+ this.elements[index] = 1 // Loading
+ $(this.slides[index]).addClass(this.options.slideLoadingClass)
+ this.slides[index].appendChild(this.createElement(
+ this.list[index],
+ this.proxyListener
+ ))
+ }
+ }
+ },
+
+ loadElements: function (index) {
+ var limit = Math.min(this.num, this.options.preloadRange * 2 + 1)
+ var j = index
+ var i
+ for (i = 0; i < limit; i += 1) {
+ // First load the current slide element (0),
+ // then the next one (+1),
+ // then the previous one (-2),
+ // then the next after next (+2), etc.:
+ j += i * (i % 2 === 0 ? -1 : 1)
+ // Connect the ends of the list to load slide elements for
+ // continuous navigation:
+ j = this.circle(j)
+ this.loadElement(j)
+ }
+ },
+
+ unloadElements: function (index) {
+ var i,
+ diff
+ for (i in this.elements) {
+ if (this.elements.hasOwnProperty(i)) {
+ diff = Math.abs(index - i)
+ if (diff > this.options.preloadRange &&
+ diff + this.options.preloadRange < this.num) {
+ this.unloadSlide(i)
+ delete this.elements[i]
+ }
+ }
+ }
+ },
+
+ addSlide: function (index) {
+ var slide = this.slidePrototype.cloneNode(false)
+ slide.setAttribute('data-index', index)
+ this.slidesContainer[0].appendChild(slide)
+ this.slides.push(slide)
+ },
+
+ positionSlide: function (index) {
+ var slide = this.slides[index]
+ slide.style.width = this.slideWidth + 'px'
+ if (this.support.transform) {
+ slide.style.left = (index * -this.slideWidth) + 'px'
+ this.move(
+ index, this.index > index
+ ? -this.slideWidth
+ : (this.index < index ? this.slideWidth : 0),
+ 0
+ )
+ }
+ },
+
+ initSlides: function (reload) {
+ var clearSlides,
+ i
+ if (!reload) {
+ this.positions = []
+ this.positions.length = this.num
+ this.elements = {}
+ this.imagePrototype = document.createElement('img')
+ this.elementPrototype = document.createElement('div')
+ this.slidePrototype = document.createElement('div')
+ $(this.slidePrototype).addClass(this.options.slideClass)
+ this.slides = this.slidesContainer[0].children
+ clearSlides = this.options.clearSlides ||
+ this.slides.length !== this.num
+ }
+ this.slideWidth = this.container[0].offsetWidth
+ this.slideHeight = this.container[0].offsetHeight
+ this.slidesContainer[0].style.width =
+ (this.num * this.slideWidth) + 'px'
+ if (clearSlides) {
+ this.resetSlides()
+ }
+ for (i = 0; i < this.num; i += 1) {
+ if (clearSlides) {
+ this.addSlide(i)
+ }
+ this.positionSlide(i)
+ }
+ // Reposition the slides before and after the given index:
+ if (this.options.continuous && this.support.transform) {
+ this.move(this.circle(this.index - 1), -this.slideWidth, 0)
+ this.move(this.circle(this.index + 1), this.slideWidth, 0)
+ }
+ if (!this.support.transform) {
+ this.slidesContainer[0].style.left =
+ (this.index * -this.slideWidth) + 'px'
+ }
+ },
+
+ unloadSlide: function (index) {
+ var slide,
+ firstChild
+ slide = this.slides[index]
+ firstChild = slide.firstChild
+ if (firstChild !== null) {
+ slide.removeChild(firstChild)
+ }
+ },
+
+ unloadAllSlides: function () {
+ var i,
+ len
+ for (i = 0, len = this.slides.length; i < len; i++) {
+ this.unloadSlide(i)
+ }
+ },
+
+ toggleControls: function () {
+ var controlsClass = this.options.controlsClass
+ if (this.container.hasClass(controlsClass)) {
+ this.container.removeClass(controlsClass)
+ } else {
+ this.container.addClass(controlsClass)
+ }
+ },
+
+ toggleSlideshow: function () {
+ if (!this.interval) {
+ this.play()
+ } else {
+ this.pause()
+ }
+ },
+
+ getNodeIndex: function (element) {
+ return parseInt(element.getAttribute('data-index'), 10)
+ },
+
+ getNestedProperty: function (obj, property) {
+ property.replace(
+ // Matches native JavaScript notation in a String,
+ // e.g. '["doubleQuoteProp"].dotProp[2]'
+ /\[(?:'([^']+)'|"([^"]+)"|(\d+))\]|(?:(?:^|\.)([^\.\[]+))/g,
+ function (str, singleQuoteProp, doubleQuoteProp, arrayIndex, dotProp) {
+ var prop = dotProp || singleQuoteProp || doubleQuoteProp ||
+ (arrayIndex && parseInt(arrayIndex, 10))
+ if (str && obj) {
+ obj = obj[prop]
+ }
+ }
+ )
+ return obj
+ },
+
+ getDataProperty: function (obj, property) {
+ if (obj.getAttribute) {
+ var prop = obj.getAttribute('data-' +
+ property.replace(/([A-Z])/g, '-$1').toLowerCase())
+ if (typeof prop === 'string') {
+ if (/^(true|false|null|-?\d+(\.\d+)?|\{[\s\S]*\}|\[[\s\S]*\])$/
+ .test(prop)) {
+ try {
+ return $.parseJSON(prop)
+ } catch (ignore) {}
+ }
+ return prop
+ }
+ }
+ },
+
+ getItemProperty: function (obj, property) {
+ var prop = obj[property]
+ if (prop === undefined) {
+ prop = this.getDataProperty(obj, property)
+ if (prop === undefined) {
+ prop = this.getNestedProperty(obj, property)
+ }
+ }
+ return prop
+ },
+
+ initStartIndex: function () {
+ var index = this.options.index
+ var urlProperty = this.options.urlProperty
+ var i
+ // Check if the index is given as a list object:
+ if (index && typeof index !== 'number') {
+ for (i = 0; i < this.num; i += 1) {
+ if (this.list[i] === index ||
+ this.getItemProperty(this.list[i], urlProperty) ===
+ this.getItemProperty(index, urlProperty)) {
+ index = i
+ break
+ }
+ }
+ }
+ // Make sure the index is in the list range:
+ this.index = this.circle(parseInt(index, 10) || 0)
+ },
+
+ initEventListeners: function () {
+ var that = this
+ var slidesContainer = this.slidesContainer
+ function proxyListener (event) {
+ var type = that.support.transition &&
+ that.support.transition.end === event.type
+ ? 'transitionend'
+ : event.type
+ that['on' + type](event)
+ }
+ $(window).on('resize', proxyListener)
+ $(document.body).on('keydown', proxyListener)
+ this.container.on('click', proxyListener)
+ if (this.support.touch) {
+ slidesContainer
+ .on('touchstart touchmove touchend touchcancel', proxyListener)
+ } else if (this.options.emulateTouchEvents &&
+ this.support.transition) {
+ slidesContainer
+ .on('mousedown mousemove mouseup mouseout', proxyListener)
+ }
+ if (this.support.transition) {
+ slidesContainer.on(
+ this.support.transition.end,
+ proxyListener
+ )
+ }
+ this.proxyListener = proxyListener
+ },
+
+ destroyEventListeners: function () {
+ var slidesContainer = this.slidesContainer
+ var proxyListener = this.proxyListener
+ $(window).off('resize', proxyListener)
+ $(document.body).off('keydown', proxyListener)
+ this.container.off('click', proxyListener)
+ if (this.support.touch) {
+ slidesContainer
+ .off('touchstart touchmove touchend touchcancel', proxyListener)
+ } else if (this.options.emulateTouchEvents &&
+ this.support.transition) {
+ slidesContainer
+ .off('mousedown mousemove mouseup mouseout', proxyListener)
+ }
+ if (this.support.transition) {
+ slidesContainer.off(
+ this.support.transition.end,
+ proxyListener
+ )
+ }
+ },
+
+ handleOpen: function () {
+ if (this.options.onopened) {
+ this.options.onopened.call(this)
+ }
+ },
+
+ initWidget: function () {
+ var that = this
+ function openHandler (event) {
+ if (event.target === that.container[0]) {
+ that.container.off(
+ that.support.transition.end,
+ openHandler
+ )
+ that.handleOpen()
+ }
+ }
+ this.container = $(this.options.container)
+ if (!this.container.length) {
+ this.console.log(
+ 'blueimp Gallery: Widget container not found.',
+ this.options.container
+ )
+ return false
+ }
+ this.slidesContainer = this.container.find(
+ this.options.slidesContainer
+ ).first()
+ if (!this.slidesContainer.length) {
+ this.console.log(
+ 'blueimp Gallery: Slides container not found.',
+ this.options.slidesContainer
+ )
+ return false
+ }
+ this.titleElement = this.container.find(
+ this.options.titleElement
+ ).first()
+ if (this.num === 1) {
+ this.container.addClass(this.options.singleClass)
+ }
+ if (this.options.onopen) {
+ this.options.onopen.call(this)
+ }
+ if (this.support.transition && this.options.displayTransition) {
+ this.container.on(
+ this.support.transition.end,
+ openHandler
+ )
+ } else {
+ this.handleOpen()
+ }
+ if (this.options.hidePageScrollbars) {
+ // Hide the page scrollbars:
+ this.bodyOverflowStyle = document.body.style.overflow
+ document.body.style.overflow = 'hidden'
+ }
+ this.container[0].style.display = 'block'
+ this.initSlides()
+ this.container.addClass(this.options.displayClass)
+ },
+
+ initOptions: function (options) {
+ // Create a copy of the prototype options:
+ this.options = $.extend({}, this.options)
+ // Check if carousel mode is enabled:
+ if ((options && options.carousel) ||
+ (this.options.carousel && (!options || options.carousel !== false))) {
+ $.extend(this.options, this.carouselOptions)
+ }
+ // Override any given options:
+ $.extend(this.options, options)
+ if (this.num < 3) {
+ // 1 or 2 slides cannot be displayed continuous,
+ // remember the original option by setting to null instead of false:
+ this.options.continuous = this.options.continuous ? null : false
+ }
+ if (!this.support.transition) {
+ this.options.emulateTouchEvents = false
+ }
+ if (this.options.event) {
+ this.preventDefault(this.options.event)
+ }
+ }
+
+ })
+
+ return Gallery
+}))
diff --git a/public/js/v1.2.4/lib/blueimp-helper.js b/public/js/v1.2.4/lib/blueimp-helper.js
new file mode 100644
index 00000000..9363ae80
--- /dev/null
+++ b/public/js/v1.2.4/lib/blueimp-helper.js
@@ -0,0 +1,190 @@
+/*
+ * blueimp helper JS
+ * https://github.com/blueimp/Gallery
+ *
+ * Copyright 2013, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+
+/* global define, window, document */
+
+;(function () {
+ 'use strict'
+
+ function extend (obj1, obj2) {
+ var prop
+ for (prop in obj2) {
+ if (obj2.hasOwnProperty(prop)) {
+ obj1[prop] = obj2[prop]
+ }
+ }
+ return obj1
+ }
+
+ function Helper (query) {
+ if (!this || this.find !== Helper.prototype.find) {
+ // Called as function instead of as constructor,
+ // so we simply return a new instance:
+ return new Helper(query)
+ }
+ this.length = 0
+ if (query) {
+ if (typeof query === 'string') {
+ query = this.find(query)
+ }
+ if (query.nodeType || query === query.window) {
+ // Single HTML element
+ this.length = 1
+ this[0] = query
+ } else {
+ // HTML element collection
+ var i = query.length
+ this.length = i
+ while (i) {
+ i -= 1
+ this[i] = query[i]
+ }
+ }
+ }
+ }
+
+ Helper.extend = extend
+
+ Helper.contains = function (container, element) {
+ do {
+ element = element.parentNode
+ if (element === container) {
+ return true
+ }
+ } while (element)
+ return false
+ }
+
+ Helper.parseJSON = function (string) {
+ return window.JSON && JSON.parse(string)
+ }
+
+ extend(Helper.prototype, {
+ find: function (query) {
+ var container = this[0] || document
+ if (typeof query === 'string') {
+ if (container.querySelectorAll) {
+ query = container.querySelectorAll(query)
+ } else if (query.charAt(0) === '#') {
+ query = container.getElementById(query.slice(1))
+ } else {
+ query = container.getElementsByTagName(query)
+ }
+ }
+ return new Helper(query)
+ },
+
+ hasClass: function (className) {
+ if (!this[0]) {
+ return false
+ }
+ return new RegExp('(^|\\s+)' + className +
+ '(\\s+|$)').test(this[0].className)
+ },
+
+ addClass: function (className) {
+ var i = this.length
+ var element
+ while (i) {
+ i -= 1
+ element = this[i]
+ if (!element.className) {
+ element.className = className
+ return this
+ }
+ if (this.hasClass(className)) {
+ return this
+ }
+ element.className += ' ' + className
+ }
+ return this
+ },
+
+ removeClass: function (className) {
+ var regexp = new RegExp('(^|\\s+)' + className + '(\\s+|$)')
+ var i = this.length
+ var element
+ while (i) {
+ i -= 1
+ element = this[i]
+ element.className = element.className.replace(regexp, ' ')
+ }
+ return this
+ },
+
+ on: function (eventName, handler) {
+ var eventNames = eventName.split(/\s+/)
+ var i
+ var element
+ while (eventNames.length) {
+ eventName = eventNames.shift()
+ i = this.length
+ while (i) {
+ i -= 1
+ element = this[i]
+ if (element.addEventListener) {
+ element.addEventListener(eventName, handler, false)
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + eventName, handler)
+ }
+ }
+ }
+ return this
+ },
+
+ off: function (eventName, handler) {
+ var eventNames = eventName.split(/\s+/)
+ var i
+ var element
+ while (eventNames.length) {
+ eventName = eventNames.shift()
+ i = this.length
+ while (i) {
+ i -= 1
+ element = this[i]
+ if (element.removeEventListener) {
+ element.removeEventListener(eventName, handler, false)
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + eventName, handler)
+ }
+ }
+ }
+ return this
+ },
+
+ empty: function () {
+ var i = this.length
+ var element
+ while (i) {
+ i -= 1
+ element = this[i]
+ while (element.hasChildNodes()) {
+ element.removeChild(element.lastChild)
+ }
+ }
+ return this
+ },
+
+ first: function () {
+ return new Helper(this[0])
+ }
+
+ })
+
+ if (typeof define === 'function' && define.amd) {
+ define(function () {
+ return Helper
+ })
+ } else {
+ window.blueimp = window.blueimp || {}
+ window.blueimp.helper = Helper
+ }
+}())
diff --git a/public/js/v1.2.4/lib/bootbox.min.js b/public/js/v1.2.4/lib/bootbox.min.js
new file mode 100644
index 00000000..0dc0cbd5
--- /dev/null
+++ b/public/js/v1.2.4/lib/bootbox.min.js
@@ -0,0 +1,6 @@
+/**
+ * bootbox.js v4.4.0
+ *
+ * http://bootboxjs.com/license.txt
+ */
+!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d.call(c,a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"",header:"",footer:"",closeButton:"",form:"",inputs:{text:"",textarea:"",email:"",select:"",checkbox:"",date:"",time:"",number:"",password:""}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback.call(this):!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,!1)},a.buttons.confirm.callback=function(){return a.callback.call(this,!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback.call(this,c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!b.isArray(k))throw new Error("Please pass an array of input options");if(!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("").attr("label",d.group)),e=o[d.group]),e.append("")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var q=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b(""),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(q,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),a.pattern&&h.attr("pattern",a.pattern),a.maxlength&&h.attr("maxlength",a.maxlength),f.append(h),f.on("submit",function(a){a.preventDefault(),a.stopPropagation(),e.find(".btn-primary").click()}),e=p.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},p.dialog=function(a){a=h(a);var d=b(n.dialog),f=d.find(".modal-dialog"),i=d.find(".modal-body"),j=a.buttons,k="",l={onEscape:a.onEscape};if(b.fn.modal===c)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");if(g(j,function(a,b){k+="",l[a]=b.callback}),i.find(".bootbox-body").html(a.message),a.animate===!0&&d.addClass("fade"),a.className&&d.addClass(a.className),"large"===a.size?f.addClass("modal-lg"):"small"===a.size&&f.addClass("modal-sm"),a.title&&i.before(n.header),a.closeButton){var m=b(n.closeButton);a.title?d.find(".modal-header").prepend(m):m.css("margin-top","-10px").prependTo(i)}return a.title&&d.find(".modal-title").html(a.title),k.length&&(i.after(n.footer),d.find(".modal-footer").html(k)),d.on("hidden.bs.modal",function(a){a.target===this&&d.remove()}),d.on("shown.bs.modal",function(){d.find(".btn-primary:first").focus()}),"static"!==a.backdrop&&d.on("click.dismiss.bs.modal",function(a){d.children(".modal-backdrop").length&&(a.currentTarget=d.children(".modal-backdrop").get(0)),a.target===a.currentTarget&&d.trigger("escape.close.bb")}),d.on("escape.close.bb",function(a){l.onEscape&&e(a,d,l.onEscape)}),d.on("click",".modal-footer button",function(a){var c=b(this).data("bb-handler");e(a,d,l[c])}),d.on("click",".bootbox-close-button",function(a){e(a,d,l.onEscape)}),d.on("keyup",function(a){27===a.which&&d.trigger("escape.close.bb")}),b(a.container).append(d),d.modal({backdrop:a.backdrop?"static":!1,keyboard:!1,show:!1}),a.show&&d.modal("show"),d},p.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(o,a)},p.hideAll=function(){return b(".bootbox").modal("hide"),p};var q={bg_BG:{OK:"ŠŠŗ",CANCEL:"ŠŃказ",CONFIRM:"ŠŠ¾ŃвŃŃŠ¶Š“авам"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"ZruÅ”it",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"ĪνĻάξει",CANCEL:"ĪĪŗĻĻĻĻĪ·",CONFIRM:"ĪĻιβεβαίĻĻĪ·"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"ŁŲØŁŁ",CANCEL:"ŁŲŗŁ",CONFIRM:"ŲŖŲ§ŪŪŲÆ"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"××ש×ר",CANCEL:"×××××",CONFIRM:"××ש×ר"},hu:{OK:"OK",CANCEL:"MĆ©gsem",CONFIRM:"MegerÅsĆt"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"ćć£ć³ć»ć«",CONFIRM:"確čŖ"},lt:{OK:"Gerai",CANCEL:"AtÅ”aukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"ApstiprinÄt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"PotwierdÅŗ"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"ŠŃмена",CONFIRM:"ŠŃимениŃŃ"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"ąøąøąø„ąø",CANCEL:"ąø¢ąøą¹ąø„ąø“ąø",CONFIRM:"ąø¢ąø·ąøąø¢ąø±ąø"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"åę¶",CONFIRM:"甮认"},zh_TW:{OK:"OK",CANCEL:"åę¶",CONFIRM:"確čŖ"}};return p.addLocale=function(a,c){return b.each(["OK","CANCEL","CONFIRM"],function(a,b){if(!c[b])throw new Error("Please supply a translation for '"+b+"'")}),q[a]={OK:c.OK,CANCEL:c.CANCEL,CONFIRM:c.CONFIRM},p},p.removeLocale=function(a){return delete q[a],p},p.setLocale=function(a){return p.setDefaults("locale",a)},p.init=function(c){return a(c||b)},p});
\ No newline at end of file
diff --git a/public/js/v1.2.4/lib/bootstrap-confirmation.js b/public/js/v1.2.4/lib/bootstrap-confirmation.js
new file mode 100644
index 00000000..08d46a33
--- /dev/null
+++ b/public/js/v1.2.4/lib/bootstrap-confirmation.js
@@ -0,0 +1,263 @@
+/*!
+ * Bootstrap Confirmation v1.0.5
+ * https://github.com/tavicu/bs-confirmation
+ */
++function ($) {
+ 'use strict';
+
+ //var for check event at body can have only one.
+ var event_body = false;
+
+ // CONFIRMATION PUBLIC CLASS DEFINITION
+ // ===============================
+ var Confirmation = function (element, options) {
+ var that = this;
+
+ this.init('confirmation', element, options);
+
+ $(element).on('show.bs.confirmation', function(e) {
+ that.options.onShow(e, this);
+
+ $(this).addClass('open');
+
+ var options = that.options;
+ var all = options.all_selector;
+
+ if(options.singleton)
+ {
+ $(all).not(that.$element).each(function()
+ {
+ if( $(this).hasClass('open') )
+ {
+ $(this).confirmation('hide');
+ }
+ });
+ }
+ });
+
+ $(element).on('hide.bs.confirmation', function(e) {
+ that.options.onHide(e, this);
+
+ $(this).removeClass('open');
+ });
+
+ $(element).on('shown.bs.confirmation', function(e) {
+ var options = that.options;
+ var all = options.all_selector;
+
+ if(that.isPopout()) {
+ if(!event_body) {
+ event_body = $('body').on('click', function (e) {
+ if(that.$element.is(e.target)) return;
+ if(that.$element.has(e.target).length) return;
+ if($('.popover').has(e.target).length) return;
+
+ that.hide();
+ that.inState.click = false;
+
+ $('body').unbind(e);
+
+ event_body = false;
+
+ return;
+ });
+ }
+ }
+ });
+
+ if(options.selector) {
+ $(element).on('click.bs.confirmation', options.selector, function(e) {
+ e.preventDefault();
+ });
+ } else {
+ $(element).on('click.bs.confirmation', function(e) {
+ e.preventDefault();
+ });
+ }
+ }
+
+ if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');
+
+ Confirmation.VERSION = '1.0.5'
+
+ Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
+ placement : 'right',
+ title : 'Are you sure?',
+ btnOkClass : 'btn btn-sm btn-danger',
+ btnOkLabel : 'Delete',
+ btnOkIcon : 'glyphicon glyphicon-ok',
+ btnCancelClass : 'btn btn-sm btn-default',
+ btnCancelLabel : 'Cancel',
+ btnCancelIcon : 'glyphicon glyphicon-remove',
+ href : '#',
+ target : '_self',
+ singleton : true,
+ popout : true,
+ onShow : function(event, element){},
+ onHide : function(event, element){},
+ onConfirm : function(event, element){},
+ onCancel : function(event, element){},
+ template : ''
+ + '
'
+ + '
'
+ + '
Yes'
+ + '
No'
+ + '
'
+ + '
'
+ });
+
+
+ // NOTE: CONFIRMATION EXTENDS popover.js
+ // ================================
+ Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype);
+
+ Confirmation.prototype.constructor = Confirmation;
+
+ Confirmation.prototype.getDefaults = function () {
+ return Confirmation.DEFAULTS;
+ }
+
+ Confirmation.prototype.setContent = function () {
+ var that = this;
+ var $tip = this.tip();
+ var title = this.getTitle();
+ var $btnOk = $tip.find('[data-apply="confirmation"]');
+ var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
+ var options = this.options
+
+ $btnOk.addClass(this.getBtnOkClass())
+ .html(this.getBtnOkLabel())
+ .prepend($('').addClass(this.getBtnOkIcon()), " ")
+ .attr('href', this.getHref())
+ .attr('target', this.getTarget())
+ .off('click').on('click', function(event) {
+ options.onConfirm(event, that.$element);
+
+ // If the button is a submit one
+ if (that.$element.attr('type') == 'submit')
+ that.$element.closest('form:first').submit();
+
+ that.hide();
+ that.inState.click = false;
+ });
+
+ $btnCancel.addClass(this.getBtnCancelClass())
+ .html(this.getBtnCancelLabel())
+ .prepend($('').addClass(this.getBtnCancelIcon()), " ")
+ .off('click').on('click', function(event){
+ options.onCancel(event, that.$element);
+
+ that.hide();
+ that.inState.click = false;
+ });
+
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
+
+ $tip.removeClass('fade top bottom left right in');
+
+ // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
+ // this manually by checking the contents.
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
+ }
+
+ Confirmation.prototype.getBtnOkClass = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call(this, $e[0]) : o.btnOkClass);
+ }
+
+ Confirmation.prototype.getBtnOkLabel = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call(this, $e[0]) : o.btnOkLabel);
+ }
+
+ Confirmation.prototype.getBtnOkIcon = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call(this, $e[0]) : o.btnOkIcon);
+ }
+
+ Confirmation.prototype.getBtnCancelClass = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call(this, $e[0]) : o.btnCancelClass);
+ }
+
+ Confirmation.prototype.getBtnCancelLabel = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call(this, $e[0]) : o.btnCancelLabel);
+ }
+
+ Confirmation.prototype.getBtnCancelIcon = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call(this, $e[0]) : o.btnCancelIcon);
+ }
+
+ Confirmation.prototype.getHref = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call(this, $e[0]) : o.href);
+ }
+
+ Confirmation.prototype.getTarget = function () {
+ var $e = this.$element;
+ var o = this.options;
+
+ return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call(this, $e[0]) : o.target);
+ }
+
+ Confirmation.prototype.isPopout = function () {
+ var popout;
+ var $e = this.$element;
+ var o = this.options;
+
+ popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call(this, $e[0]) : o.popout);
+
+ if(popout == 'false') popout = false;
+
+ return popout
+ }
+
+
+ // CONFIRMATION PLUGIN DEFINITION
+ // =========================
+ var old = $.fn.confirmation;
+
+ $.fn.confirmation = function (option) {
+ var that = this;
+
+ return this.each(function () {
+ var $this = $(this);
+ var data = $this.data('bs.confirmation');
+ var options = typeof option == 'object' && option;
+
+ options = options || {};
+ options.all_selector = that.selector;
+
+ if (!data && option == 'destroy') return;
+ if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options)));
+ if (typeof option == 'string') data[option]();
+ });
+ }
+
+ $.fn.confirmation.Constructor = Confirmation
+
+
+ // CONFIRMATION NO CONFLICT
+ // ===================
+ $.fn.confirmation.noConflict = function () {
+ $.fn.confirmation = old;
+
+ return this;
+ }
+}(jQuery);
diff --git a/public/js/v1.2.4/lib/bootstrap-editable.min.js b/public/js/v1.2.4/lib/bootstrap-editable.min.js
new file mode 100644
index 00000000..e2703aee
--- /dev/null
+++ b/public/js/v1.2.4/lib/bootstrap-editable.min.js
@@ -0,0 +1,7 @@
+/*! X-editable - v1.5.1
+* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
+* http://github.com/vitalets/x-editable
+* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
+!function(a){"use strict";var b=function(b,c){this.options=a.extend({},a.fn.editableform.defaults,c),this.$div=a(b),this.options.scope||(this.options.scope=this)};b.prototype={constructor:b,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value),this.input.prerender()},initTemplate:function(){this.$form=a(a.fn.editableform.template)},initButtons:function(){var b=this.$form.find(".editable-buttons");b.append(a.fn.editableform.buttons),"bottom"===this.options.showbuttons&&b.addClass("editable-buttons-bottom")},render:function(){this.$loading=a(a.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),a.when(this.input.render()).then(a.proxy(function(){if(this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(a.proxy(this.cancel,this)),this.input.error)this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(a){a.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var b=null===this.value||void 0===this.value||""===this.value?this.options.defaultValue:this.value;this.input.value2input(b),this.$form.submit(a.proxy(this.submit,this))}this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var a,b;this.$form?(a=this.$form.outerWidth(),b=this.$form.outerHeight(),a&&this.$loading.width(a),b&&this.$loading.height(b),this.$form.hide()):(a=this.$loading.parent().width(),a&&this.$loading.width(a)),this.$loading.show()},showForm:function(a){this.$loading.hide(),this.$form.show(),a!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(b){var c,d=this.$form.find(".control-group"),e=this.$form.find(".editable-error-block");if(b===!1)d.removeClass(a.fn.editableform.errorGroupClass),e.removeClass(a.fn.editableform.errorBlockClass).empty().hide();else{if(b){c=(""+b).split("\n");for(var f=0;f").text(c[f]).html();b=c.join("
")}d.addClass(a.fn.editableform.errorGroupClass),e.addClass(a.fn.editableform.errorBlockClass).html(b).show()}},submit:function(b){b.stopPropagation(),b.preventDefault();var c=this.input.input2value(),d=this.validate(c);if("object"===a.type(d)&&void 0!==d.newValue){if(c=d.newValue,this.input.value2input(c),"string"==typeof d.msg)return this.error(d.msg),this.showForm(),void 0}else if(d)return this.error(d),this.showForm(),void 0;if(!this.options.savenochange&&this.input.value2str(c)==this.input.value2str(this.value))return this.$div.triggerHandler("nochange"),void 0;var e=this.input.value2submit(c);this.isSaving=!0,a.when(this.save(e)).done(a.proxy(function(a){this.isSaving=!1;var b="function"==typeof this.options.success?this.options.success.call(this.options.scope,a,c):null;return b===!1?(this.error(!1),this.showForm(!1),void 0):"string"==typeof b?(this.error(b),this.showForm(),void 0):(b&&"object"==typeof b&&b.hasOwnProperty("newValue")&&(c=b.newValue),this.error(!1),this.value=c,this.$div.triggerHandler("save",{newValue:c,submitValue:e,response:a}),void 0)},this)).fail(a.proxy(function(a){this.isSaving=!1;var b;b="function"==typeof this.options.error?this.options.error.call(this.options.scope,a,c):"string"==typeof a?a:a.responseText||a.statusText||"Unknown error!",this.error(b),this.showForm()},this))},save:function(b){this.options.pk=a.fn.editableutils.tryParseJson(this.options.pk,!0);var c,d="function"==typeof this.options.pk?this.options.pk.call(this.options.scope):this.options.pk,e=!!("function"==typeof this.options.url||this.options.url&&("always"===this.options.send||"auto"===this.options.send&&null!==d&&void 0!==d));return e?(this.showLoading(),c={name:this.options.name||"",value:b,pk:d},"function"==typeof this.options.params?c=this.options.params.call(this.options.scope,c):(this.options.params=a.fn.editableutils.tryParseJson(this.options.params,!0),a.extend(c,this.options.params)),"function"==typeof this.options.url?this.options.url.call(this.options.scope,c):a.ajax(a.extend({url:this.options.url,data:c,type:"POST"},this.options.ajaxOptions))):void 0},validate:function(a){return void 0===a&&(a=this.value),"function"==typeof this.options.validate?this.options.validate.call(this.options.scope,a):void 0},option:function(a,b){a in this.options&&(this.options[a]=b),"value"===a&&this.setValue(b)},setValue:function(a,b){this.value=b?this.input.str2value(a):a,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},a.fn.editableform=function(c){var d=arguments;return this.each(function(){var e=a(this),f=e.data("editableform"),g="object"==typeof c&&c;f||e.data("editableform",f=new b(this,g)),"string"==typeof c&&f[c].apply(f,Array.prototype.slice.call(d,1))})},a.fn.editableform.Constructor=b,a.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},a.fn.editableform.template='',a.fn.editableform.loading='',a.fn.editableform.buttons='',a.fn.editableform.errorGroupClass=null,a.fn.editableform.errorBlockClass="editable-error",a.fn.editableform.engine="jquery"}(window.jQuery),function(a){"use strict";a.fn.editableutils={inherit:function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a,a.superclass=b.prototype},setCursorPosition:function(a,b){if(a.setSelectionRange)a.setSelectionRange(b,b);else if(a.createTextRange){var c=a.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",b),c.select()}},tryParseJson:function(a,b){if("string"==typeof a&&a.length&&a.match(/^[\{\[].*[\}\]]$/))if(b)try{a=new Function("return "+a)()}catch(c){}finally{return a}else a=new Function("return "+a)();return a},sliceObj:function(b,c,d){var e,f,g={};if(!a.isArray(c)||!c.length)return g;for(var h=0;h").text(b).html()},itemsByValue:function(b,c,d){if(!c||null===b)return[];if("function"!=typeof d){var e=d||"value";d=function(a){return a[e]}}var f=a.isArray(b),g=[],h=this;return a.each(c,function(c,e){if(e.children)g=g.concat(h.itemsByValue(b,e.children,d));else if(f)a.grep(b,function(a){return a==(e&&"object"==typeof e?d(e):e)}).length&&g.push(e);else{var i=e&&"object"==typeof e?d(e):e;b==i&&g.push(e)}}),g},createInput:function(b){var c,d,e,f=b.type;return"date"===f&&("inline"===b.mode?a.fn.editabletypes.datefield?f="datefield":a.fn.editabletypes.dateuifield&&(f="dateuifield"):a.fn.editabletypes.date?f="date":a.fn.editabletypes.dateui&&(f="dateui"),"date"!==f||a.fn.editabletypes.date||(f="combodate")),"datetime"===f&&"inline"===b.mode&&(f="datetimefield"),"wysihtml5"!==f||a.fn.editabletypes[f]||(f="textarea"),"function"==typeof a.fn.editabletypes[f]?(c=a.fn.editabletypes[f],d=this.sliceObj(b,this.objectKeys(c.defaults)),e=new c(d)):(a.error("Unknown type: "+f),!1)},supportsTransitions:function(){var a=document.body||document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(a){if(this.tip()&&this.tip().is(":visible")&&this.$element.hasClass("editable-open")){if(this.$form.data("editableform").isSaving)return this.delayedHide={reason:a},void 0;this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",a||"manual")}},innerShow:function(){},innerHide:function(){},toggle:function(a){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(a)},setPosition:function(){},save:function(a,b){this.$element.triggerHandler("save",b),this.hide("save")},option:function(a,b){this.options[a]=b,a in this.containerOptions?(this.containerOptions[a]=b,this.setContainerOption(a,b)):(this.formOptions[a]=b,this.$form&&this.$form.editableform("option",a,b))},setContainerOption:function(a,b){this.call("option",a,b)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(b){a(".editable-open").each(function(c,d){if(d!==b&&!a(d).find(b).length){var e=a(d),f=e.data("editableContainer");f&&("cancel"===f.options.onblur?e.data("editableContainer").hide("onblur"):"submit"===f.options.onblur&&e.data("editableContainer").tip().find("form").submit())}})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},a.fn.editableContainer=function(d){var e=arguments;return this.each(function(){var f=a(this),g="editableContainer",h=f.data(g),i="object"==typeof d&&d,j="inline"===i.mode?c:b;h||f.data(g,h=new j(this,i)),"string"==typeof d&&h[d].apply(h,Array.prototype.slice.call(e,1))})},a.fn.editableContainer.Popup=b,a.fn.editableContainer.Inline=c,a.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(a){a.handler&&a.handler()}}}(window.jQuery),function(a){"use strict";a.extend(a.fn.editableContainer.Inline.prototype,a.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=a(""),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,a.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.editable.defaults,c,a.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!a.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};b.prototype={constructor:b,init:function(){var b,c=!1;if(this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=a.fn.editableutils.createInput(this.options),this.input){switch(void 0===this.options.value||null===this.options.value?(this.value=this.input.html2value(a.trim(this.$element.html())),c=!0):(this.options.value=a.fn.editableutils.tryParseJson(this.options.value,!0),this.value="string"==typeof this.options.value?this.input.str2value(this.options.value):this.options.value),this.$element.addClass("editable"),"textarea"===this.input.type&&this.$element.addClass("editable-pre-wrapped"),"manual"!==this.options.toggle?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",a.proxy(function(a){if(this.options.disabled||a.preventDefault(),"mouseenter"===this.options.toggle)this.show();else{var b="click"!==this.options.toggle;this.toggle(b)}},this))):this.$element.attr("tabindex",-1),"function"==typeof this.options.display&&(this.options.autotext="always"),this.options.autotext){case"always":b=!0;break;case"auto":b=!a.trim(this.$element.text()).length&&null!==this.value&&void 0!==this.value&&!c;break;default:b=!1}a.when(b?this.render():!0).then(a.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))}},initLive:function(){var b=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",b,a.proxy(function(b){var c=a(b.target);c.data("editable")||(c.hasClass(this.options.emptyclass)&&c.empty(),c.editable(this.options).trigger(b))},this))},render:function(a){return this.options.display!==!1?this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,a):"function"==typeof this.options.display?this.options.display.call(this.$element[0],this.value,a):this.input.value2html(this.value,this.$element[0]):void 0},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),"manual"!==this.options.toggle&&"-1"===this.$element.attr("tabindex")&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(b,c){return b&&"object"==typeof b?(a.each(b,a.proxy(function(b,c){this.option(a.trim(b),c)},this)),void 0):(this.options[b]=c,"disabled"===b?c?this.disable():this.enable():("value"===b&&this.setValue(c),this.container&&this.container.option(b,c),this.input.option&&this.input.option(b,c),void 0))},handleEmpty:function(b){this.options.display!==!1&&(this.isEmpty=void 0!==b?b:"function"==typeof this.input.isEmpty?this.input.isEmpty(this.$element):""===a.trim(this.$element.html()),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass))},show:function(b){if(!this.options.disabled){if(this.container){if(this.container.tip().is(":visible"))return}else{var c=a.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(c),this.$element.on("save.internal",a.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}this.container.show(b)}},hide:function(){this.container&&this.container.hide()},toggle:function(a){this.container&&this.container.tip().is(":visible")?this.hide():this.show(a)},save:function(a,b){if(this.options.unsavedclass){var c=!1;c=c||"function"==typeof this.options.url,c=c||this.options.display===!1,c=c||void 0!==b.response,c=c||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(b.newValue),c?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var d=this.$element,e=d.css("background-color");d.css("background-color",this.options.highlight),setTimeout(function(){"transparent"===e&&(e=""),d.css("background-color",e),d.addClass("editable-bg-transition"),setTimeout(function(){d.removeClass("editable-bg-transition")},1700)},10)}this.setValue(b.newValue,!1,b.response)},validate:function(){return"function"==typeof this.options.validate?this.options.validate.call(this,this.value):void 0},setValue:function(b,c,d){this.value=c?this.input.str2value(b):b,this.container&&this.container.option("value",this.value),a.when(this.render(d)).then(a.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),"manual"!==this.options.toggle&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},a.fn.editable=function(c){var d={},e=arguments,f="editable";switch(c){case"validate":return this.each(function(){var b,c=a(this),e=c.data(f);e&&(b=e.validate())&&(d[e.options.name]=b)}),d;case"getValue":return 2===arguments.length&&arguments[1]===!0?d=this.eq(0).data(f).value:this.each(function(){var b=a(this),c=b.data(f);c&&void 0!==c.value&&null!==c.value&&(d[c.options.name]=c.input.value2submit(c.value))}),d;case"submit":var g=arguments[1]||{},h=this,i=this.editable("validate");if(a.isEmptyObject(i)){var j={};if(1===h.length){var k=h.data("editable"),l={name:k.options.name||"",value:k.input.value2submit(k.value),pk:"function"==typeof k.options.pk?k.options.pk.call(k.options.scope):k.options.pk};"function"==typeof k.options.params?l=k.options.params.call(k.options.scope,l):(k.options.params=a.fn.editableutils.tryParseJson(k.options.params,!0),a.extend(l,k.options.params)),j={url:k.options.url,data:l,type:"POST"},g.success=g.success||k.options.success,g.error=g.error||k.options.error}else{var m=this.editable("getValue");j={url:g.url,data:m,type:"POST"}}j.success="function"==typeof g.success?function(a){g.success.call(h,a,g)}:a.noop,j.error="function"==typeof g.error?function(){g.error.apply(h,arguments)}:a.noop,g.ajaxOptions&&a.extend(j,g.ajaxOptions),g.data&&a.extend(j.data,g.data),a.ajax(j)}else"function"==typeof g.error&&g.error.call(h,i);return this}return this.each(function(){var d=a(this),g=d.data(f),h="object"==typeof c&&c;return h&&h.selector?(g=new b(this,h),void 0):(g||d.data(f,g=new b(this,h)),"string"==typeof c&&g[c].apply(g,Array.prototype.slice.call(e,1)),void 0)})},a.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(a){"use strict";a.fn.editabletypes={};var b=function(){};b.prototype={init:function(b,c,d){this.type=b,this.options=a.extend({},d,c)},prerender:function(){this.$tpl=a(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(b,c){a(c)[this.options.escape?"text":"html"](a.trim(b))},html2value:function(b){return a("").html(b).text()},value2str:function(a){return a},str2value:function(a){return a},value2submit:function(a){return a},value2input:function(a){this.$input.val(a)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(b){return a("
").text(b).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(a){void 0!==this.options[a]&&null!==this.options[a]&&this.$input.attr(a,this.options[a])},option:function(a,b){this.options[a]=b}},b.defaults={tpl:"",inputclass:null,escape:!0,scope:null,showbuttons:!0},a.extend(a.fn.editabletypes,{abstractinput:b})}(window.jQuery),function(a){"use strict";var b=function(){};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){var b=a.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),b.resolve()},function(){this.error=this.options.sourceError,b.resolve()}),b.promise()},html2value:function(){return null},value2html:function(b,c,d,e){var f=a.Deferred(),g=function(){"function"==typeof d?d.call(c,b,this.sourceData,e):this.value2htmlFinal(b,c),f.resolve()};return null===b?g.call(this):this.onSourceReady(g,function(){f.resolve()}),f.promise()},onSourceReady:function(b,c){var d;if(a.isFunction(this.options.source)?(d=this.options.source.call(this.options.scope),this.sourceData=null):d=this.options.source,this.options.sourceCache&&a.isArray(this.sourceData))return b.call(this),void 0;try{d=a.fn.editableutils.tryParseJson(d,!1)}catch(e){return c.call(this),void 0}if("string"==typeof d){if(this.options.sourceCache){var f,g=d;if(a(document).data(g)||a(document).data(g,{}),f=a(document).data(g),f.loading===!1&&f.sourceData)return this.sourceData=f.sourceData,this.doPrepend(),b.call(this),void 0;if(f.loading===!0)return f.callbacks.push(a.proxy(function(){this.sourceData=f.sourceData,this.doPrepend(),b.call(this)},this)),f.err_callbacks.push(a.proxy(c,this)),void 0;f.loading=!0,f.callbacks=[],f.err_callbacks=[]}var h=a.extend({url:d,type:"get",cache:!1,dataType:"json",success:a.proxy(function(d){f&&(f.loading=!1),this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(f&&(f.sourceData=this.sourceData,a.each(f.callbacks,function(){this.call()})),this.doPrepend(),b.call(this)):(c.call(this),f&&a.each(f.err_callbacks,function(){this.call()}))},this),error:a.proxy(function(){c.call(this),f&&(f.loading=!1,a.each(f.err_callbacks,function(){this.call()}))},this)},this.options.sourceOptions);a.ajax(h)}else this.sourceData=this.makeArray(d),a.isArray(this.sourceData)?(this.doPrepend(),b.call(this)):c.call(this)},doPrepend:function(){null!==this.options.prepend&&void 0!==this.options.prepend&&(a.isArray(this.prependData)||(a.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=a.fn.editableutils.tryParseJson(this.options.prepend,!0),"string"==typeof this.options.prepend&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),a.isArray(this.prependData)&&a.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData)))},renderList:function(){},value2htmlFinal:function(){},makeArray:function(b){var c,d,e,f,g=[];if(!b||"string"==typeof b)return null;if(a.isArray(b)){f=function(a,b){return d={value:a,text:b},c++>=2?!1:void 0};for(var h=0;h
1&&(e.children&&(e.children=this.makeArray(e.children)),g.push(e))):g.push({value:e,text:e})}else a.each(b,function(a,b){g.push({value:a,text:b})});return g},option:function(a,b){this.options[a]=b,"source"===a&&(this.sourceData=null),"prepend"===a&&(this.prependData=null)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0,sourceOptions:null}),a.fn.editabletypes.list=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("text",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),a.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=a(''),this.$input.after(this.$clear).css("padding-right",24).keyup(a.proxy(function(b){if(!~a.inArray(b.keyCode,[40,38,9,13,27])){clearTimeout(this.t);var c=this;this.t=setTimeout(function(){c.toggleClear(b)},100)}},this)).parent().css("position","relative"),this.$clear.click(a.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(){if(this.$clear){var a=this.$input.val().length,b=this.$clear.is(":visible");a&&!b&&this.$clear.show(),!a&&b&&this.$clear.hide()}},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),a.fn.editabletypes.text=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("textarea",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.abstractinput),a.extend(b.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(b){b.ctrlKey&&13===b.which&&a(this).closest("form").submit()})},activate:function(){a.fn.editabletypes.text.prototype.activate.call(this)}}),b.defaults=a.extend({},a.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),a.fn.editabletypes.textarea=b}(window.jQuery),function(a){"use strict";var b=function(a){this.init("select",a,b.defaults)};a.fn.editableutils.inherit(b,a.fn.editabletypes.list),a.extend(b.prototype,{renderList:function(){this.$input.empty();var b=function(c,d){var e;if(a.isArray(d))for(var f=0;f",e),d[f].children))):(e.value=d[f].value,d[f].disabled&&(e.disabled=!0),c.append(a("