/* Duration: 0.017s */ if(typeof logging === 'undefined') { // ### FUNCTION ############################################# # var logging = (function () { var lastlog = '', loadlog = [], caption = 18; return { parse: function(arguments) { var output = []; for(i in arguments) { var msg = arguments[i]; if(typeof msg =='string') { var col = msg.substr(0,2)=='%c' ? msg.substr(2,1) : false, msg = col ? msg.substr(0,2)+msg.substr(3) : msg; if(i==0) { for(var j = msg.length ; j < caption + 2; j++) { msg = msg + '.'; } msg = msg + ':' } } else var col = false; output.push(msg); switch(col) { case 'd' : output.push('color:#AAA;'); break; case 'r' : output.push('color:#F00;'); break; case 'b' : output.push('color:#00A;'); break; case 'g' : output.push('color:#0A0;'); break; case 'y' : output.push('color:#FA0;'); break; } } return output; }, start: function(plugin) { loadlog[plugin] = new Date(); }, stop: function(plugin,show) { var LoadStart = loadlog[plugin], LoadEnd = new Date(); if(show!==false) logging.log('%cd'+plugin,((LoadEnd.getTime()-LoadStart.getTime())/100)+'s'); }, space: function() { if(lastlog!='space') { console.log(' '); lastlog = 'space'; } }, log: function() { lastlog = 'log'; console.log.apply(console, logging.parse(arguments)); }, info: function() { lastlog = 'info'; console.info.apply(console, logging.parse(arguments)); }, warn: function() { lastlog = 'warn'; console.warn.apply(console, logging.parse(arguments)); }, error: function() { lastlog = 'error'; console.error.apply(console, logging.parse(arguments)); }, require: function(arguments){ console.warn('%c'+arguments+' is required','color:#F00;font-weight:bold;'); } } }()); } else console.log('load logging.js at first'); if(typeof loadedScripts==='undefined') var loadedScripts = {}; var jClone = jQuery; // ### TRINITY JS Framework ################################# # if( typeof TRINITY === 'undefined' && typeof Proxy !== 'undefined' ) { TRINITY = (function() { var version = '1.0.0', TRINITY = function( widget, method ) { return jQuery( this )[widget].call( this, method ); }; TRINITY.version = version; TRINITY.storage = {}; TRINITY.widgets = {}; TRINITY.extends = {}; TRINITY.scripts = []; TRINITY.create = function( args ) { new Function('\ jQuery.fn.' + args.name + ' = function( action, event ) {\ if( !this.length ) return this; \ var __func = {}; \ for( var i in arguments.callee.methods ) \ { \ if( typeof arguments.callee.methods[i] === \'function\' ) \ { \ __func[i] = arguments.callee.methods[i].bind(this, event, arguments.callee ); \ } \ } \ \ if( typeof arguments.callee.events[ action ] === \'string\' ) \ { \ if( !jQuery( event.target ).is( arguments.callee.events[ action ] )) return this; \ } \ \ if( action == \'init\' ) var loadTime = new Date();\ var result = action ? __func[action]( event ) : this; \ if( action == \'init\' ) jQuery.fn.' + args.name + '.loadTime = ( ( ( new Date() ).getTime()- loadTime.getTime() ) / 100 ) + \'s\';\ return result; \ };\ ')(); jQuery.fn[ args.name ].version = args.version; jQuery.fn[ args.name ].config = args.config; jQuery.fn[ args.name ].methods = args.methods; jQuery.fn[ args.name ].events = args.events; jQuery.fn[ args.name ].cache = {}; for( var event in args.events ) { var selectors = args.events[ event ]; switch( event ) { case 'scroll' : case 'wheel' : var domObject = 'window'; break; default : var domObject = 'document'; } new Function('\ jQuery( ' + domObject + ' ).on( \'' + event + '\', ' + ( selectors ? '\'' + selectors + '\', ' : '' ) + 'function( event )\ {\ jQuery(this).' + args.name + '( \'' + event + '\', event ); \ }); \ ')(); } TRINITY.scripts.push( jQuery.fn[ args.name ] ); }; TRINITY.func = [ 'action', 'event', '\ if( !this.length ) return this; \ var __func = {}; \ for( var i in arguments.callee ) \ { \ if( typeof arguments.callee[i] === \'function\' ) \ { \ __func[i] = arguments.callee[i].bind(this); \ } \ } \ switch( action ) \ { \ case \'initilize\' : \ if( typeof arguments.callee.config.initialize !== \'undefined\' ) \ { \ if( !jQuery( event.target ).is( arguments.callee.config.initialize )) return this; \ } \ break; \ } \ return action ? __func[action]( event ) : this; \ ' ]; TRINITY.widget = new Proxy( TRINITY, { set: function( target, widget, settings ) { if( typeof TRINITY.widgets[widget] === 'undefined' ) { TRINITY.widgets[widget] = []; } if( typeof TRINITY.storage[widget] === 'undefined' ) { TRINITY.storage[widget] = {}; } if( settings._ready ) { jQuery(document).ready( settings._ready ); } jQuery.fn[widget] = function( options ) { this.fn = settings; TRINITY.extend.call( this ); if( !jQuery(this).is( '[data-init-' + widget + ']' ) ) { TRINITY.extends.init.call( this, widget ); if( this.fn._init ) { jQuery(this).each(function() { settings._init.call( this ); }); } } switch( typeof options ) { case 'undefined' : for( var name in this.fn ) { if( typeof this.fn[name] === 'function' && name.substr(1) !== '_' ) { this[name] = this.fn[name].bind( this ); } } break; case 'string' : if( this.fn[options] ) { // logging.log('Action',options); this.fn[options].call( this ); } break; case 'object' : logging.log('object',options,settings); break; } return this; }; }, }); TRINITY.extend = function() { for( var name in TRINITY.extends ) { this[name] = TRINITY.extends[name].bind( this ); } }; Object.defineProperty( TRINITY, 'widget', { enumerable: false }); Object.defineProperty( TRINITY, 'extend', { enumerable: false }); Object.defineProperty( TRINITY, 'version', { enumerable: false }); Object.defineProperty( TRINITY, 'extends', { enumerable: false }); TRINITY.extends.uniqid = function( prefix ) { if( jQuery(this).length == 0 ) return false; if( jQuery(this).hasAttr( 'id' ) ) { var id = jQuery(this).attr( 'id' ); if( jQuery( '#' + id ).length <= 1 ) { return jQuery( 'BODY' ).find( '#' + id ); } } var uid = prefix; do { uid += ~~( Math.random() * 1000000 ); } while( document.getElementById( uid ) ); jQuery( this ).attr( 'id', uid ); return jQuery( 'BODY' ).find( '#' + uid ); }; TRINITY.extends.init = function( widget ) { jQuery(this).each(function() { TRINITY.extends.uniqid.call( this, widget ); jQuery(this).attr( 'data-init-' + widget, Date.now() ); }); }; delete TRINITY.name; delete TRINITY.length; return TRINITY; })(); } // ### LOGGING ############################################## # if(typeof logging === 'undefined') { var logging = {}; ['start','stop','space','log','info','warn','error'].forEach(function(key){ logging[key] = function(){}; }); console.log('logging is not available'); logging.require = function(arguments){ console.warn('%c'+arguments+' is required','color:#F00;font-weight:bold;'); }; } jQuery(function(){ jQuery('div[onload]').trigger('onload'); }); // ### REQUIRED ############################################# # var isMobile = navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i), ReadyList = {'first':[],'default':[],'last':[]}, KeyStatus = {'ctrl':false,'alt':false,'shift':false,'touch':[{v:0,h:0,x:0,y:0,s:{x:0,y:0}}],'mouse':[{v:0,h:0,x:0,y:0,s:{x:0,y:0}},false,false,false],'scroll':{'x':0,'y':0,'last':Date.now(),'timeout':false,'prevent':false}}, screenSizes = { 'xl' : 1920, 'lg' : 1600, 'md' : 1360, 'sm' : 1024, 'xs' : 768, 'xxs' : 480, }; var pathScripts = 'library/scripts/', pathExternal = 'library/external/scripts/'; if(navigator.cookieEnabled) { var SessionId = /SESS\w*ID=([^;]+)/i.test(document.cookie) ? RegExp.$1 : ''; var SecureKey = SessionId.replace(/[a-zA-Z]/g,''); logging.log('%cbSession-ID',SessionId); jQuery('HTML').removeClass('cookies-*').addClass('cookies-enabled'); } else { logging.log('%crSession-ID','Cookies disabled'); jQuery('HTML').removeClass('cookies-*').addClass('cookies-disabled'); } logging.log('%cbHashTag',location.hash.substr(1)); jQuery.onReadyFirst = function(fn) { ReadyList.first.unshift(fn); }; jQuery.onReady = function(fn) { ReadyList.default.push(fn); }; jQuery.onReadyLast = function(fn) { ReadyList.last.push(fn); }; var grid = document.createElement('div'); grid.style.display = 'block'; grid.style.display = 'flex'; grid.style.display = 'grid'; jQuery('HTML').addClass('grid-'+grid.style.display); logging.log('%cbSupported CSS-Grid',grid.style.display); jQuery(window).resize(function(event){ var width = jQuery(window).width(), height = jQuery(window).height(), size = 'xl'; for( i in screenSizes ) { if( width <= screenSizes[i] ) { size = i; if( jQuery( '[data-background-' + i + ']' ).length ) { jQuery( '[data-background-' + i + ']' ).each(function() { var image = jQuery(this).attr( 'data-background-' + i ); jQuery(this).css( 'background-image', 'url(' + image + ')' ); }); } } } jQuery('HTML') .attr('data-width',width) .attr('data-height',height) .removeClass('screen-*').addClass( 'screen-' + size ); logging.log( '%cbScreensize', 'screen-' + size + ' (' + width + ' x ' + height + 'px)' ); jQuery('HTML').attr('data-width',width).removeClass(function (index, className) { return (className.match (/(^|\s)screen-\S+/g) || []).join(' '); }).addClass( 'screen-' + size ); }); jQuery(window).resize(); jQuery(document).ready(function(){ logging.space(); logging.log('%cbLoaded Scripts',Object.keys(loadedScripts).join(', ')); logging.log('%cbLoaded Scripts', Object.keys( trinity.scripts ).join(', ')); jQuery(this).initialize(); }); window.addEventListener('keydown',function(event){ switch(event.which) { case 16 : KeyStatus.shift = true; break; case 17 : KeyStatus.ctrl = true; break; case 18 : KeyStatus.alt = true; break; } }); window.addEventListener('keyup',function(event){ switch(event.which) { case 16 : KeyStatus.shift = false; break; case 17 : KeyStatus.ctrl = false; break; case 18 : KeyStatus.alt = false; break; } }); window.addEventListener('mousedown',function(event){ KeyStatus.mouse[event.which] = true; KeyStatus.mouse[0] = { h : 0, v : 0, x : event.pageX, y : event.pageY, s : { x : event.screenX, y : event.screenY, }, }; KeyStatus.scroll.v = jQuery('html,body').scrollTop(); }); window.addEventListener('mousemove',function(event){ KeyStatus.mouse[0] = { h : KeyStatus.mouse[0].s.x - event.screenX, v : KeyStatus.mouse[0].s.y - event.screenY, x : event.pageX, y : event.pageY, s : KeyStatus.mouse[0].s, }; }); window.addEventListener('mouseup',function(event){ KeyStatus.mouse[event.which] = false; KeyStatus.mouse[0] = { h : KeyStatus.mouse[0].s.x - event.screenX, v : KeyStatus.mouse[0].s.y - event.screenY, x : event.pageX, y : event.pageY, s : KeyStatus.mouse[0].s, }; KeyStatus.scroll.v = jQuery('html,body').scrollTop(); }); jQuery(window) .on( 'scroll', function( event ) { if( KeyStatus.scroll.prevent ) return; if( KeyStatus.scroll.last + 100 < Date.now() ) { jQuery(this).trigger( 'scrollstart' ); KeyStatus.scroll.x = jQuery( 'html' ).scrollLeft() || jQuery( 'body' ).scrollLeft(); KeyStatus.scroll.y = jQuery( 'html' ).scrollTop() || jQuery( 'body' ).scrollTop(); } var x = jQuery( 'html' ).scrollLeft() || jQuery( 'body' ).scrollLeft(), y = jQuery( 'html' ).scrollTop() || jQuery( 'body' ).scrollTop(), h = KeyStatus.scroll.x - x, v = KeyStatus.scroll.y - y; if(v > 0 ) var eventType = 'scrollup'; else if(v < 0 ) var eventType = 'scrolldown'; else if(h > 0 ) var eventType = 'scrollleft'; else if(h < 0 ) var eventType = 'scrollright'; if( typeof eventType !== 'undefined' ) { jQuery( this ).trigger( eventType ); jQuery( 'HTML' ).removeClass( 'scrollup scrolldown scrollleft scrollright' ).addClass( eventType ); } KeyStatus.scroll.last = Date.now(); clearTimeout( KeyStatus.scroll.timeout ); KeyStatus.scroll.timeout = setTimeout( function() { if( KeyStatus.scroll.last + 100 <= Date.now() ) { jQuery(this).trigger( 'scrollend' ); } }, 100 ); }); // jCLONE FUNCTIONS ########################################## # jQuery.onReadyLast(function(){ jQuery('[data-click^="#"],[data-click^="."],[data-click^="["]').click(function(){ jQuery(jQuery(this).data('click')).click(); }); jQuery('[data-auto=click]').click(); }); jQuery.fn.triggerAll = function( eventType, extraParameter ) { return jQuery(this).find('*').trigger( eventType, extraParameter ); }; jQuery.fn.call = function(name,options) { if(!jQuery.isFunction(jQuery[name])){ jQuery.ajax({ url : pathScripts+name+'.js', dataType: 'script', async : false, success : function(){ logging.info('%cdLoaded',name); } }); } return jQuery(this)[name](options); }; jQuery.call = function(name,options) { if(!jQuery.isFunction(jQuery[name])){ jQuery.ajax({ url : pathScripts+name+'.js', dataType: 'script', async : false, success : function(){ logging.info('%cdLoaded',name); } }); } return jQuery[name](options); }; /* jQuery.fn.triggerOld = jQuery.fn.trigger; jQuery.fn.trigger = function() { logging.info( arguments[0], this ); jQuery(this).triggerOld.apply(this, arguments); } */ jQuery.fn.reverse = function() { return this.pushStack(this.get().reverse(), arguments); }; jQuery.fn.initialize = function() { logging.space(); logging.log('%cbInitalize',this.selector || this[0].nodeName); var LoadStart = new Date(); for(var obj in ReadyList) { for(var i in ReadyList[obj]) { ReadyList[obj][i](this); } } var LoadEnd = new Date(); jQuery(this).triggerAll( 'init' ); logging.log('%cbonReady',((LoadEnd.getTime()-LoadStart.getTime())/100)+'s'); logging.space(); return this; }; jQuery.fn.scrollTo = function(){ if(jQuery(this).length) { var oParents = jQuery(this).parents('html, body, .scroll'); oParents.scrollTop(0); oParents.animate({scrollTop: jQuery(this).offset().top},'slow'); } }; jQuery.fn.removeClass = function(argument) { if( typeof argument === 'string' ) { var arguments = argument.split(' '); for(i in arguments) { var argument = arguments[i]; if( typeof argument === 'string' ) { if(argument.substr(-1,1)==='*') { prefix = argument.substr(0,argument.length-1); } else prefix = false; this.each(function(i,it) { var classes = it.className.split(' ').map(function(item) { if(prefix) return item.indexOf(prefix) === 0 ? "" : item; else return item == argument ? "" : item; }); it.className = classes.join(' '); }); } } } return this; }; /* jQuery.fn.replaceWithOld = jQuery.fn.replaceWith; jQuery.fn.replaceWith = function(newContent,returnOld) { var oNewContent = jQuery(newContent), oOldContent = this.replaceWithOld(oNewContent); return returnOld ? oOldContent : oNewContent; }; */ jQuery.fn.replaceTag = function(tagName,withDataAndEvents,deepWithDataAndEvents) { var newTag = jQuery('<' + tagName + '>')[0]; jQuery.each(this[0].attributes, function() { newTag.setAttribute(this.name, this.value); }); jQuery(newTag).text( jQuery(this).text() ); jQuery(this).children().clone(withDataAndEvents || true, deepWithDataAndEvents || true).appendTo(newTag); return jQuery(this).replaceWith(newTag); }; jQuery.fn.with = function(elems,callback){ return this.each(function(index){ jQuery(elems,this).each(callback).bind(index); }); }; jQuery.fn.Data = function( name, defaults, loadHtml ) { function setByArray( object, array, value ) { var key = array.shift(); if( array.length == 0 ) { object[key] = value; } else { if( typeof object[key] === 'undefined' ) object[key] = {}; setByArray( object[key], array, value ); } } var defaults = typeof defaults === 'undefined' ? [] : defaults.reduceKey( '-' ), data = {}, name = name ? name + '-' : '', name = 'data-' + name, len = name.length, oThis = jQuery(this); if( typeof this[0] !== 'undefined' ) { jQuery.each(this[0].attributes, function() { if( this.specified && this.name.substr( 0, len ) == name ) { var col = defaults.getKey( this.name.substr( len ) ), val = oThis.attr( this.name ), key = col.split('-'); // console.log( name, col, this.name.substr( len ), key, val ); if( val.isBoolean() ) val = val.asBoolean(); else if( val.isNumber() ) val = +val; setByArray(data,key,val); if( loadHtml && typeof data[col] == 'string' && data[col].substr( 0, 1 ) == '#' ) data[col] = jQuery( data[col] ).html(); } }); } if( typeof oThis.attr('href') !== 'undefined' && oThis.attr('href').substr( 0, 11 ) != 'javascript:' ) { if( typeof data.container==='undefined' ) { data.container = oThis.attr('href'); } else data.href = oThis.attr('href'); } if( defaults ) { var obj = {}; for( var name in defaults ) { if( typeof defaults[name] !== 'undefined' ) { var val = defaults[name], key = name.split('-'); setByArray(obj,key,val); } } data = jQuery.extend(true,{},obj,data); } return data; }; jQuery.fn.isEmpty = function(name) { return !jQuery.trim(jQuery(this).html()); }; jQuery.fn.hasAttr = function(name) { return typeof this.attr(name) !== 'undefined'; }; jQuery.fn.hasData = function(name) { return typeof this.data(name) !== 'undefined'; }; jQuery.fn.setUID = function(prefix,current,hash) { if( jQuery(this).length == 0 ) return false; if(jQuery(this).hasAttr('id')) { var id = jQuery(this).attr('id'); if(jQuery('[id='+id+']').length==1) { return jQuery('BODY').find('#'+id); } } var uid = uniqid(prefix); hash= hash || null; if(jQuery(this).hasClass(prefix)) { jQuery(this).attr('id',uid); } else if(current==true) { jQuery(this).attr('id',uid); } else { jQuery(this).find('.'+prefix+':not([id])').attr('id',uid); } return jQuery('BODY').find('#'+uid); }; jQuery.fn.getUID = function(prefix,hash) { if( jQuery(this).length == 0 ) return false; hash = hash==true ? '#' : ''; if(jQuery(this).hasClass(prefix)) { return hash+jQuery(this).attr('id'); } else { return hash+jQuery(this).parents('.'+prefix).attr('id'); } }; jQuery.fn.sort = function(func) { var list = [], detach = [], uid = ~~(Math.random() * 1000000); for( var i in this ) { if(isNaN(i)) break; list[i] = this[i]; } list.sort(func); detach = jQuery('BODY').append('
').find('#SortHelper'+uid); for( var i in list ) { jQuery(list[i]).detach().appendTo(detach); } var oDetach = detach.children().detach(); detach.remove(); return oDetach; }; // FUNCTIONS ################################################# # function uniqid( prefix, more_entropy ) { var uid = prefix; do { var rand = Date.now() / 1000; var rand = rand.toString( 16 ).split('.').join(''); while( rand.length < 14 ) { rand += '0'; } if( more_entropy ) { rand += ~~( Math.random() * 1000000 ); } uid += rand; } while( document.getElementById( uid ) ); return uid; } function hexToBase64(str) { return btoa(String.fromCharCode.apply(null, str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))); } function getRemote(remote,type) { if(remote.substr(0,7)=='http://') return remote; if(remote.substr(0,8)=='https://') return remote; return remote.replace(/(\/[a-zA-Z]{2})?(\/popup|ajax|json)?\/(.*)/g,'$1/'+type+'/$3'); } function fileSize(bytes,decimals,format) { if(bytes==0) return '0 Byte'; var sizes = ['Bytes','KB','MB','GB','TB','PB']; var i = Math.floor(Math.log(bytes) / Math.log(1000)); if(format=='size') return parseFloat((bytes / Math.pow(1000, i)).toFixed(decimals)); else if(format=='type') return sizes[i]; else return parseFloat((bytes / Math.pow(1000, i)).toFixed(decimals)) + ' ' + sizes[i]; } function number_format(number, decimals, dec_point, thousands_sep) { var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, toFixedFix = function (n, prec) { // Fix for IE parseFloat(0.55).toFixed(0) = 0; var k = Math.pow(10, prec); return Math.round(n * k) / k; }, s = (prec ? toFixedFix(n, prec) : Math.round(n)).toString().split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec); } // PROTOTYPE FUNCTIONS ####################################### # String.prototype.str_pad = function(length,string) { var result = this.toString(), string = string || ' '; for(var x = result.length ; x <= length ; x++) { result = result + string; } return result; }; String.prototype.getQuery = function(parse) { var pos = this.indexOf('?'), query = pos!=-1 ? this.substr(pos+1) : ''; if(parse!=false) { var vars = query.split('&'), query = {}; for(var i = 0; i < vars.length; i++) { if(vars[i]=='') continue; var pair = vars[i].split('='); query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); } if(typeof parse=='object') { query = jQuery.extend(true,{},query,parse); } } return query; }; Object.defineProperty( Object.prototype, 'getKey', { value : function( key ) { var keys = Object.keys( this ); if( typeof key === 'string' ) { for( var i in keys ) { if( typeof keys[i] === 'string' ) { if( keys[i].toLowerCase() == key.toLowerCase() ) { return keys[i]; } } } } return key; }, enumerable : false, writable : true }); Object.defineProperty( Object.prototype, 'getByKey', { value : function( key ) { var key = this.getKey( key ); return this[key]; }, enumerable : false }); // Object.defineProperty( Object.prototype, 'reduceKey', // { // value : function( split ) // { // var newObj = {}; // for( var i in this ) // { // if( !this.hasOwnProperty(i) ) continue; // if( typeof this[i] == 'object' ) // { // var flatObj = this[i].reduceKey(split); // for( var x in flatObj ) // { // if( !flatObj.hasOwnProperty(x) ) continue; // newObj[i + split + x] = flatObj[x]; // } // } // else newObj[i] = this[i]; // } // return newObj; // }, // enumerable : false // }); Boolean.prototype.asInt = function() { return this==true ? 1 : 0; }; String.prototype.asInt = function() { return parseInt(this); }; String.prototype.isInteger = function(key,value) { return this.match( /^-{0,1}\d+$/ ) ? true : false; }; // String.prototype.isNumber = function() { // return this.match( /^-{0,1}\d+\.?\d*$/ ) ? true : false; // }; // String.prototype.isBoolean = function() { // return this.match( /^(true|false)$/ ) ? true : false; // }; // String.prototype.asBoolean = function() { // return this.match( /^(0|false)$/ ) ? false : true; // }; String.prototype.asFloat = function() { return parseFloat(this); }; String.prototype.addQuery = function(key,value) { var add = this.indexOf('?')==-1 ? '?' : '&'; return this + add + key + ( value ? '=' + value : '' ); }; String.prototype.getReferer = function() { var pos = this.indexOf('?'); return pos!=-1 ? this.substr(0,pos) : this; }; String.prototype.catchHtml = function(tag) { var results = {wrap:'',attr:{},html:''}; regMatch = new RegExp('<'+tag+'[^<]*>[\\s\\S]*<\/'+tag+'>','ig'), regRemove = new RegExp('<\/?'+tag+'[^<]*>','ig'), regAttr = new RegExp('<'+tag+'[^<]*>','ig'), content = this.match(regMatch)[0], attributes = this.match(regAttr)[0], attributes = attributes.substr(tag.length + 1,attributes.length - tag.length - 2).trim(); attributes.split(' ').forEach(function(element){ var pair = element.split('='); results.attr[pair[0]] = pair[1].substr(1,pair[1].length-2); }); results.wrap = '<'+tag+' '+attributes+'>'+tag+'>'; results.html = content.replace(regRemove,''); return results; }; Number.prototype.format = function(decimals, dec_point, thousands_sep) { var n = !isFinite(+this) ? 0 : +this, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, toFixedFix = function (n, prec) { // Fix for IE parseFloat(0.55).toFixed(0) = 0; var k = Math.pow(10, prec); return Math.round(n * k) / k; }, s = (prec ? toFixedFix(n, prec) : Math.round(n)).toString().split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec); }; Math.getRand = function(min,max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min +1)) + min; }; // ### SET LOADSTATUS ####################################### # loadedScripts.extends = true;if( typeof trinity === 'undefined' ) { trinity = (function() { var VERSION = '1.1.0'; var EVENTS = [ 'click', 'change', 'submit', 'scroll' ]; var QUEUEED = {}; var METHODS = {}; var SCRIPTS = {}; var TRINITY = function( selector ) { var elements = typeof selector == 'string' ? document.querySelectorAll( selector ) : selector; if( elements.constructor.name == 'HTMLDivElement' ) { elements = Reflect.construct( Array, [ elements ], NodeList); } for( i in TRINITY.scripts ) { elements[i] = TRINITY.scripts[ i ].bind( elements ); } elements.forEach(function( element ) { if( !element.hasOwnProperty( 'trinity' ) ) element.trinity = {}; for( i in METHODS ) { element.trinity[ i ] = METHODS[i].bind( element ); } }); return elements; }; var DEPENDENCY = function( args, dependencyNames ) { var result = false; if( typeof dependencyNames === 'string' ) { dependencyNames = [ dependencyNames ]; } for( var x in dependencyNames ) { var dependencies = args[ dependencyNames[ x ] ]; if( typeof dependencies === 'string' ) { dependencies = [ dependencies ]; } for( var i in dependencies ) { var dependency = dependencies[ i ]; if( typeof QUEUEED === 'undefined' ) { QUEUEED = {}; } QUEUEED[ args.name ] = args; if( !TRINITY.scripts[ dependency ] ) { result = true; } } } return result; }; METHODS.uniqid = function( prefix ) { var uid = prefix; do { uid += ~~( Math.random() * 1000000 ); } while( document.getElementById( uid ) ); return this.id = uid; }; METHODS.wrap = function( wrapper ) { switch( wrapper.substr( 0, 1 ) ) { case '.' : var selector = wrapper, attribute = 'class', wrapper = 'div'; break; case '#' : var selector = wrapper, attribute = 'id', wrapper = 'div'; break; } var container = this.closest( selector ); if( !container ) { var container = document.createElement( wrapper ); this.parentNode.insertBefore( container, this ); container.appendChild( this ); switch( attribute ) { case 'class' : container.classList.add( selector.substr( 1 ) ); break; case 'id' : container.id = selector.substr( 1 ); break; } } return container; } TRINITY.version = '2.0.0'; TRINITY.scripts = {}; TRINITY.events = {}; TRINITY.createElement = function( element ) { return trinity.init( document.createElement( element ) ); }; TRINITY.init = function( element, script ) { if( !element.hasOwnProperty( 'trinity' ) ) element.trinity = {}; if( !element.trinity.hasOwnProperty( 'cache' ) ) element.trinity.cache = {}; if( !element.trinity.hasOwnProperty( 'events' ) ) element.trinity.events = {}; if( !element.trinity.hasOwnProperty( 'options' ) ) element.trinity.options = {}; if( !element.trinity.hasOwnProperty( 'elements' ) ) element.trinity.elements = {}; if( !element.trinity.hasOwnProperty( 'initialized' ) ) element.trinity.initialized = {}; var scripts = script ? [ SCRIPTS[ script ] ] : SCRIPTS; for( i in scripts ) { var script = scripts[ i ]; if( element.trinity.initialized[ script.name ] ) return; element.trinity.cache = Object.assign( element.trinity.cache, element.parseDataset( script.name, script.cache ) ); element.trinity.options = Object.assign( element.trinity.options, element.parseDataset( script.name, script.config ) ); element.trinity[ script.name ] = {}; for( i in script.events ) { element.trinity.events[ script.events[ i ] ] = new CustomEvent( script.events[ i ], { bubbles: true } ); } for( i in script.extends ) { element.trinity[ script.name ][ i ] = script.extends[ i ].bind( element ); } for( i in script.methods ) { element.trinity[ script.name ][ i ] = script.methods[ i ].bind( element ); } for( i in METHODS ) { element.trinity[ i ] = METHODS[i].bind( element ); } if( script.init ) { if( element.matches( script.selector ) ) { script.init.call( element, element.trinity[ script.name ] ); } } element.trinity.initialized[ script.name ] = true; } return element; }; TRINITY.create = function( args ) { if( TRINITY.scripts[ args.name ] ) return true; if( DEPENDENCY( args, [ 'required', 'dependency' ] ) ) return false; SCRIPTS[ args.name ] = args; // console.log( args.name ); if( args.ready ) { document.addEventListener( 'DOMContentLoaded', args.ready ); } for( i in args.events ) { if( !EVENTS.includes( args.events[ i ] ) ) { args.events[ i ] = args.name + args.events[ i ].toUpperCaseFirst(); } } if( typeof args.functions !== 'undefined' ) { TRINITY[ args.name ] = {}; TRINITY[ args.name ].version = args.version; TRINITY[ args.name ].config = args.config; TRINITY[ args.name ].type = args.type; TRINITY[ args.name ].name = args.name; for( i in args.functions ) { TRINITY[ args.name ][ i ] = args.functions[ i ]; } TRINITY.scripts[ args.name ] = TRINITY[ args.name ]; } TRINITY.scripts[ args.name ] = function() { this.forEach(function( element ) { // console.log( element, args.name ); TRINITY.init( element, args.name ); }); }; TRINITY.scripts[ args.name ].version = args.version; TRINITY.scripts[ args.name ].type = args.type || 'script'; TRINITY.scripts[ args.name ].selector = args.selector; TRINITY.scripts[ args.name ].config = args.config; TRINITY.scripts[ args.name ].events = args.events; TRINITY.scripts[ args.name ].cache = args.cache || {}; // if( TRINITY.scripts[ args.name ].selector ) // { // document.addEventListener( 'DOMContentLoaded', function( event ) // { // TRINITY( TRINITY.scripts[ args.name ].selector )[ args.name ](); // }); // } for( i in args.events ) { TRINITY.events[ args.events[ i ] ] = new CustomEvent( args.events[ i ], { bubbles: true } ); } if( QUEUEED ) { for( var i in QUEUEED ) { if( TRINITY.create( QUEUEED[ i ] ) ) { delete QUEUEED[ i ]; } } } // console.log( Object.keys( TRINITY.scripts ) ); return true; }; document.addEventListener( 'DOMContentLoaded', function( event ) { if( Object.keys( QUEUEED ).length ) { for( var i in QUEUEED ) { if( DEPENDENCY( QUEUEED[ i ], [ 'required' ] ) ) continue; QUEUEED[ i ].dependency = []; if( TRINITY.create( QUEUEED[ i ] ) ) { delete QUEUEED[ i ]; } } } if( Object.keys( TRINITY.scripts ).length ) { for( var i in TRINITY.scripts ) { if( TRINITY.scripts[ i ].selector ) { TRINITY( TRINITY.scripts[ i ].selector )[ i ](); } } } }); delete TRINITY.name; delete TRINITY.length; return TRINITY; })(); }if( typeof String.prototype.getType === 'undefined' ) { String.prototype.getType = function() { if( this.length !== 1 ) return false; else if( this.match(/[0-9]/) ) return 'number'; else if( this.match(/[a-z]/) ) return 'lowercase'; else if( this.match(/[A-Z]/) ) return 'uppercase'; else return 'specialchar'; }; } if( typeof String.prototype.isBoolean === 'undefined' ) { String.prototype.isBoolean = function() { return this.match( /^(true|false)$/ ) ? true : false; }; } if( typeof String.prototype.toUpperCaseFirst === 'undefined' ) { String.prototype.toUpperCaseFirst = function() { return this.charAt(0).toUpperCase() + this.slice(1); }; } if( typeof String.prototype.isNumber === 'undefined' ) { String.prototype.isNumber = function() { return this.match( /^-{0,1}\d+\.?\d*$/ ) ? true : false; }; } if( typeof String.prototype.asBoolean === 'undefined' ) { String.prototype.asBoolean = function() { return this.match( /^(0|false)$/ ) ? false : true; }; } if( typeof Node.prototype.next === 'undefined' ) { Node.prototype.next = function( nodeList ) { for( var i = 0; i < nodeList.length; i++ ) { if( nodeList[ i ] == this ) { i++; if( i == nodeList.length ) { i = 0; } return nodeList[ i ]; } } } } if( typeof Node.prototype.prev === 'undefined' ) { Node.prototype.prev = function( nodeList ) { for( var i = 0; i < nodeList.length; i++ ) { if( nodeList[ i ] == this ) { i--; if( i < 0 ) { i = nodeList.length - 1; } return nodeList[ i ]; } } } } if( typeof Node.prototype.appendTo === 'undefined' ) { Node.prototype.appendTo = function( parent ) { parent.append( this ); } } if( typeof Node.prototype.prependTo === 'undefined' ) { Node.prototype.prependTo = function( parent ) { parent.prepend( this ); } } if( typeof Node.prototype.childSelector === 'undefined' ) { Node.prototype.childSelector = function( selector ) { for( var i = 0; i < this.children.length; i++ ) { if( this.children[ i ].matches( selector ) ) { return this.children[ i ]; } } } } if( typeof Node.prototype.parseDataset === 'undefined' ) { Node.prototype.parseDataset = function( namespace, options ) { var helper = {}; helper[ namespace ] = options; var options = helper.reduceKey(); for( key in options ) { if( this.dataset.hasOwnProperty( key ) ) { options[ key ] = this.dataset[ key ]; } if( typeof options[ key ] == 'string' ) { if( options[ key ].isBoolean() ) options[ key ] = options[ key ].asBoolean(); else if( options[ key ].isNumber() ) options[ key ] = +options[ key ]; } } return options; }; } if( typeof Object.prototype.reduceKey === 'undefined' ) { Object.defineProperty( Object.prototype, 'reduceKey', { value : function( split ) { var newObj = {}; for( var i in this ) { if( !this.hasOwnProperty(i) ) continue; if( typeof this[i] == 'object' ) { var flatObj = this[i].reduceKey( split ); for( var x in flatObj ) { if( !flatObj.hasOwnProperty(x) ) continue; if( typeof split == 'undefined' ) { newObj[i + x.toUpperCaseFirst()] = flatObj[x]; } else newObj[i + split + x] = flatObj[x]; } } else newObj[i] = this[i]; } return newObj; }, enumerable : false }); }if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, 'includes', { value: function(searchElement, fromIndex) { if (this == null) { throw new TypeError('"this" is null or not defined'); } // 1. Let O be ? ToObject(this value). var o = Object(this); // 2. Let len be ? ToLength(? Get(O, "length")). var len = o.length >>> 0; // 3. If len is 0, return false. if (len === 0) { return false; } // 4. Let n be ? ToInteger(fromIndex). // (If fromIndex is undefined, this step produces the value 0.) var n = fromIndex | 0; // 5. If n ≥ 0, then // a. Let k be n. // 6. Else n < 0, // a. Let k be len + n. // b. If k < 0, let k be 0. var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); function sameValueZero(x, y) { return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); } // 7. Repeat, while k < len while (k < len) { // a. Let elementK be the result of ? Get(O, ! ToString(k)). // b. If SameValueZero(searchElement, elementK) is true, return true. if (sameValueZero(o[k], searchElement)) { return true; } // c. Increase k by 1. k++; } // 8. Return false return false; } }); } (function () { if ( typeof window.CustomEvent === "function" ) return false; function CustomEvent ( event, params ) { params = params || { bubbles: false, cancelable: false, detail: null }; var evt = document.createEvent( 'CustomEvent' ); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); return evt; } window.CustomEvent = CustomEvent; })(); if (!Array.prototype.forEach) { Array.prototype.forEach = function(callback, thisArg) { var T, k; if (this === null) { throw new TypeError(' this is null or not defined'); } // 1. Let O be the result of calling ToObject passing the |this| value as the argument. var O = Object(this); // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". // 3. Let len be ToUint32(lenValue). var len = O.length >>> 0; // 4. If IsCallable(callback) is false, throw a TypeError exception. // See: http://es5.github.com/#x9.11 if (typeof callback !== "function") { throw new TypeError(callback + ' is not a function'); } // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. if (arguments.length > 1) { T = thisArg; } // 6. Let k be 0 k = 0; // 7. Repeat, while k < len while (k < len) { var kValue; // a. Let Pk be ToString(k). // This is implicit for LHS operands of the in operator // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. // This step can be combined with c // c. If kPresent is true, then if (k in O) { // i. Let kValue be the result of calling the Get internal method of O with argument Pk. kValue = O[k]; // ii. Call the Call internal method of callback with T as the this value and // argument list containing kValue, k, and O. callback.call(T, kValue, k, O); } // d. Increase k by 1. k++; } // 8. return undefined }; } if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach; } if (window.NodeList && !NodeList.prototype.apply) { NodeList.prototype.apply = function( method, args ) { for( var i in args ) { this[ method ]( args[i] ); } }; } if (window.DOMTokenList && !DOMTokenList.prototype.apply) { DOMTokenList.prototype.apply = function( method, args ) { for( var i in args ) { this[ method ]( args[i] ); } }; } if (typeof Object.assign != 'function') { // Must be writable: true, enumerable: false, configurable: true Object.defineProperty(Object, "assign", { value: function assign(target, varArgs) { // .length of function is 2 'use strict'; if (target == null) { // TypeError if undefined or null throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments[index]; if (nextSource != null) { // Skip over if undefined or null for (var nextKey in nextSource) { // Avoid bugs when hasOwnProperty is shadowed if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }, writable: true, configurable: true }); } if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; } if (!Element.prototype.closest) { Element.prototype.closest = function(s) { var el = this; do { if (el.matches(s)) return el; el = el.parentElement || el.parentNode; } while (el !== null && el.nodeType === 1); return null; }; } (function (arr) { arr.forEach(function (item) { if (item.hasOwnProperty('remove')) { return; } Object.defineProperty(item, 'remove', { configurable: true, enumerable: true, writable: true, value: function remove() { console.log('X'); if (this.parentNode !== null) this.parentNode.removeChild(this); } }); }); })([Element.prototype, CharacterData.prototype, DocumentType.prototype]);/* ############################################################################ # */ /* ### REQUIRED ############################################################# # */ /* ############################################################################ # */ /*! * jQuery Mobile Events * by Ben Major * * Copyright 2011-2017, Ben Major * Licensed under the MIT License: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ "use strict"; (function ($) { $.attrFn = $.attrFn || {}; // navigator.userAgent.toLowerCase() isn't reliable for Chrome installs // on mobile devices. As such, we will create a boolean isChromeDesktop // The reason that we need to do this is because Chrome annoyingly // purports support for touch events even if the underlying hardware // does not! var touchCapable = ('ontouchstart' in window), settings = { tap_pixel_range: 5, swipe_h_threshold: 50, swipe_v_threshold: 50, taphold_threshold: 750, doubletap_int: 500, touch_capable: touchCapable, orientation_support: ('orientation' in window && 'onorientationchange' in window), startevent: (touchCapable) ? 'touchstart' : 'mousedown', endevent: (touchCapable) ? 'touchend' : 'mouseup', moveevent: (touchCapable) ? 'touchmove' : 'mousemove', tapevent: (touchCapable) ? 'tap' : 'click', scrollevent: (touchCapable) ? 'touchmove' : 'scroll', hold_timer: null, tap_timer: null }; // Convenience functions: $.isTouchCapable = function() { return settings.touch_capable; }; $.getStartEvent = function() { return settings.startevent; }; $.getEndEvent = function() { return settings.endevent; }; $.getMoveEvent = function() { return settings.moveevent; }; $.getTapEvent = function() { return settings.tapevent; }; $.getScrollEvent = function() { return settings.scrollevent; }; // Add Event shortcuts: $.each(['tapstart', 'tapend', 'tapmove', 'tap', 'tap2', 'tap3', 'tap4', 'singletap', 'doubletap', 'taphold', 'swipe', 'swipeup', 'swiperight', 'swipedown', 'swipeleft', 'swipeend', 'scrollstart', 'scrollend', 'orientationchange'], function (i, name) { $.fn[name] = function (fn) { return fn ? this.on(name, fn) : this.trigger(name); }; $.attrFn[name] = true; }); // tapstart Event: $.event.special.tapstart = { setup: function () { var thisObject = this, $this = $(thisObject); $this.on(settings.startevent, function tapStartFunc(e) { $this.data('callee', tapStartFunc); if (! e.originalEvent) { return; } if (e.which && e.which !== 1) { return false; } var origEvent = e.originalEvent, touchData = { 'position': { 'x': ((settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX), 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapstart', e, touchData); return true; }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee); } }; // tapmove Event: $.event.special.tapmove = { setup: function() { var thisObject = this, $this = $(thisObject); $this.on(settings.moveevent, function tapMoveFunc(e) { $this.data('callee', tapMoveFunc); if (! e.originalEvent) { return; } var origEvent = e.originalEvent, touchData = { 'position': { 'x': ((settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX), 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapmove', e, touchData); return true; }); }, remove: function() { $(this).off(settings.moveevent, $(this).data.callee); } }; // tapend Event: $.event.special.tapend = { setup: function () { var thisObject = this, $this = $(thisObject); $this.on(settings.endevent, function tapEndFunc(e) { // Touch event data: $this.data('callee', tapEndFunc); if (! e.originalEvent) { return; } var origEvent = e.originalEvent; var touchData = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; triggerCustomEvent(thisObject, 'tapend', e, touchData); return true; }); }, remove: function () { $(this).off(settings.endevent, $(this).data.callee); } }; // taphold Event: $.event.special.taphold = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget, start_pos = { x: 0, y: 0 }, end_x = 0, end_y = 0; $this.on(settings.startevent, function tapHoldFunc1(e) { if (! e.originalEvent) { return; } if (e.which && e.which !== 1) { return false; } else { $this.data('tapheld', false); origTarget = e.target; var origEvent = e.originalEvent; var start_time = Date.now(), startPosition = { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, startOffset = { 'x': (settings.touch_capable) ? origEvent.touches[0].pageX - origEvent.touches[0].target.offsetLeft : e.offsetX, 'y': (settings.touch_capable) ? origEvent.touches[0].pageY - origEvent.touches[0].target.offsetTop : e.offsetY }; start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; end_x = start_pos.x; end_y = start_pos.y; // Get the element's threshold: var ele_threshold = ($this.parent().data('threshold')) ? $this.parent().data('threshold') : $this.data('threshold'), threshold = (typeof ele_threshold !== 'undefined' && ele_threshold !== false && parseInt(ele_threshold)) ? parseInt(ele_threshold) : settings.taphold_threshold; settings.hold_timer = window.setTimeout(function () { var diff_x = (start_pos.x - end_x), diff_y = (start_pos.y - end_y); if (e.target == origTarget && ((start_pos.x == end_x && start_pos.y == end_y) || (diff_x >= -(settings.tap_pixel_range) && diff_x <= settings.tap_pixel_range && diff_y >= -(settings.tap_pixel_range) && diff_y <= settings.tap_pixel_range))) { $this.data('tapheld', true); var end_time = Date.now(), endPosition = { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, endOffset = { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }; var duration = end_time - start_time; // Build the touch data: var touchData = { 'startTime': start_time, 'endTime': end_time, 'startPosition': startPosition, 'startOffset': startOffset, 'endPosition': endPosition, 'endOffset': endOffset, 'duration': duration, 'target': e.target }; $this.data('callee1', tapHoldFunc1); triggerCustomEvent(thisObject, 'taphold', e, touchData); } }, threshold); return true; } }).on(settings.endevent, function tapHoldFunc2() { $this.data('callee2', tapHoldFunc2); $this.data('tapheld', false); window.clearTimeout(settings.hold_timer); }) .on(settings.moveevent, function tapHoldFunc3(e) { $this.data('callee3', tapHoldFunc3); if (! e.originalEvent) { return; } end_x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; end_y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2).off(settings.moveevent, $(this).data.callee3); } }; // doubletap Event: $.event.special.doubletap = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget, action, firstTap = null, origEvent, cooloff, cooling = false; $this.on(settings.startevent, function doubleTapFunc1(e) { if (! e.originalEvent) { return; } if (e.which && e.which !== 1) { return false; } $this.data('doubletapped', false); origTarget = e.target; $this.data('callee1', doubleTapFunc1); origEvent = e.originalEvent; if (!firstTap) { firstTap = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target, 'element': e.originalEvent.srcElement, 'index': $(e.target).index() }; } return true; }).on(settings.endevent, function doubleTapFunc2(e) { if (! e.originalEvent) { return; } var now = Date.now(); var lastTouch = $this.data('lastTouch') || now + 1; var delta = now - lastTouch; window.clearTimeout(action); $this.data('callee2', doubleTapFunc2); if (delta < settings.doubletap_int && ($(e.target).index() == firstTap.index) && delta > 100) { $this.data('doubletapped', true); window.clearTimeout(settings.tap_timer); // Now get the current event: var lastTap = { 'position': { 'x': (settings.touch_capable) ? e.originalEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? e.originalEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target, 'element': e.originalEvent.srcElement, 'index': $(e.target).index() }; var touchData = { 'firstTap': firstTap, 'secondTap': lastTap, 'interval': lastTap.time - firstTap.time }; if (!cooling) { triggerCustomEvent(thisObject, 'doubletap', e, touchData); firstTap = null; } cooling = true; cooloff = window.setTimeout(function () { cooling = false; }, settings.doubletap_int); } else { $this.data('lastTouch', now); action = window.setTimeout(function () { firstTap = null; window.clearTimeout(action); }, settings.doubletap_int, [e]); } $this.data('lastTouch', now); }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // singletap Event: // This is used in conjuction with doubletap when both events are needed on the same element $.event.special.singletap = { setup: function () { var thisObject = this, $this = $(thisObject), origTarget = null, startTime = null, start_pos = { x: 0, y: 0 }; $this.on(settings.startevent, function singleTapFunc1(e) { if (! e.originalEvent) { return; } if (e.which && e.which !== 1) { return false; } else { startTime = Date.now(); origTarget = e.target; $this.data('callee1', singleTapFunc1); // Get the start x and y position: start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; return true; } }).on(settings.endevent, function singleTapFunc2(e) { $this.data('callee2', singleTapFunc2); if (! e.originalEvent) { return; } if (e.target == origTarget) { // Get the end point: var end_pos_x = (e.originalEvent.changedTouches) ? e.originalEvent.changedTouches[0].pageX : e.pageX, end_pos_y = (e.originalEvent.changedTouches) ? e.originalEvent.changedTouches[0].pageY : e.pageY; // We need to check if it was a taphold: settings.tap_timer = window.setTimeout(function () { var diff_x = (start_pos.x - end_pos_x), diff_y = (start_pos.y - end_pos_y); if(!$this.data('doubletapped') && !$this.data('tapheld') && (((start_pos.x == end_pos_x) && (start_pos.y == end_pos_y)) || (diff_x >= -(settings.tap_pixel_range) && diff_x <= settings.tap_pixel_range && diff_y >= -(settings.tap_pixel_range) && diff_y <= settings.tap_pixel_range))) { var origEvent = e.originalEvent; var touchData = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; // Was it a taphold? if((touchData.time - startTime) < settings.taphold_threshold) { triggerCustomEvent(thisObject, 'singletap', e, touchData); } } }, settings.doubletap_int); } }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // tap Event: $.event.special.tap = { setup: function () { var thisObject = this, $this = $(thisObject), started = false, origTarget = null, start_time, start_pos = { x: 0, y: 0 }, touches; $this.on(settings.startevent, function tapFunc1(e) { $this.data('callee1', tapFunc1); if (! e.originalEvent) { return; } if( e.which && e.which !== 1 ) { return false; } else { started = true; start_pos.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; start_pos.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; start_time = Date.now(); origTarget = e.target; touches = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches : [ e ]; return true; } }).on(settings.endevent, function tapFunc2(e) { $this.data('callee2', tapFunc2); if (! e.originalEvent) { return; } // Only trigger if they've started, and the target matches: var end_x = (e.originalEvent.targetTouches) ? e.originalEvent.changedTouches[0].pageX : e.pageX, end_y = (e.originalEvent.targetTouches) ? e.originalEvent.changedTouches[0].pageY : e.pageY, diff_x = (start_pos.x - end_x), diff_y = (start_pos.y - end_y), eventName; if (origTarget == e.target && started && ((Date.now() - start_time) < settings.taphold_threshold) && ((start_pos.x == end_x && start_pos.y == end_y) || (diff_x >= -(settings.tap_pixel_range) && diff_x <= settings.tap_pixel_range && diff_y >= -(settings.tap_pixel_range) && diff_y <= settings.tap_pixel_range))) { var origEvent = e.originalEvent; var touchData = [ ]; for( var i = 0; i < touches.length; i++) { var touch = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[i].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[i].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[i].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[i].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; touchData.push( touch ); } triggerCustomEvent(thisObject, 'tap', e, touchData); } }); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.endevent, $(this).data.callee2); } }; // swipe Event (also handles swipeup, swiperight, swipedown and swipeleft): $.event.special.swipe = { setup: function () { var thisObject = this, $this = $(thisObject), started = false, hasSwiped = false, originalCoord = { x: 0, y: 0 }, finalCoord = { x: 0, y: 0 }, startEvnt; // Screen touched, store the original coordinate function touchStart(e) { if (! e.originalEvent) { return; } $this = $(e.currentTarget); $this.data('callee1', touchStart); originalCoord.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; originalCoord.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; finalCoord.x = originalCoord.x; finalCoord.y = originalCoord.y; started = true; var origEvent = e.originalEvent; // Read event data into our startEvt: startEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; } // Store coordinates as finger is swiping function touchMove(e) { if (! e.originalEvent) { return; } $this = $(e.currentTarget); $this.data('callee2', touchMove); finalCoord.x = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageX : e.pageX; finalCoord.y = (e.originalEvent.targetTouches) ? e.originalEvent.targetTouches[0].pageY : e.pageY; var swipedir; // We need to check if the element to which the event was bound contains a data-xthreshold | data-vthreshold: var ele_x_threshold = ($this.parent().data('xthreshold')) ? $this.parent().data('xthreshold') : $this.data('xthreshold'), ele_y_threshold = ($this.parent().data('ythreshold')) ? $this.parent().data('ythreshold') : $this.data('ythreshold'), h_threshold = (typeof ele_x_threshold !== 'undefined' && ele_x_threshold !== false && parseInt(ele_x_threshold)) ? parseInt(ele_x_threshold) : settings.swipe_h_threshold, v_threshold = (typeof ele_y_threshold !== 'undefined' && ele_y_threshold !== false && parseInt(ele_y_threshold)) ? parseInt(ele_y_threshold) : settings.swipe_v_threshold; if (originalCoord.y > finalCoord.y && (originalCoord.y - finalCoord.y > v_threshold)) { swipedir = 'swipeup'; } if (originalCoord.x < finalCoord.x && (finalCoord.x - originalCoord.x > h_threshold)) { swipedir = 'swiperight'; } if (originalCoord.y < finalCoord.y && (finalCoord.y - originalCoord.y > v_threshold)) { swipedir = 'swipedown'; } if (originalCoord.x > finalCoord.x && (originalCoord.x - finalCoord.x > h_threshold)) { swipedir = 'swipeleft'; } if (swipedir != undefined && started) { originalCoord.x = 0; originalCoord.y = 0; finalCoord.x = 0; finalCoord.y = 0; started = false; // Read event data into our endEvnt: var origEvent = e.originalEvent; var endEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.touches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.touches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; // Calculate the swipe amount (normalized): var xAmount = Math.abs(startEvnt.position.x - endEvnt.position.x), yAmount = Math.abs(startEvnt.position.y - endEvnt.position.y); var touchData = { 'startEvnt': startEvnt, 'endEvnt': endEvnt, 'direction': swipedir.replace('swipe', ''), 'xAmount': xAmount, 'yAmount': yAmount, 'duration': endEvnt.time - startEvnt.time }; hasSwiped = true; $this.trigger('swipe', touchData).trigger(swipedir, touchData); } } function touchEnd(e) { if (! e.originalEvent) { return; } $this = $(e.currentTarget); var swipedir = ""; $this.data('callee3', touchEnd); if (hasSwiped) { // We need to check if the element to which the event was bound contains a data-xthreshold | data-vthreshold: var ele_x_threshold = $this.data('xthreshold'), ele_y_threshold = $this.data('ythreshold'), h_threshold = (typeof ele_x_threshold !== 'undefined' && ele_x_threshold !== false && parseInt(ele_x_threshold)) ? parseInt(ele_x_threshold) : settings.swipe_h_threshold, v_threshold = (typeof ele_y_threshold !== 'undefined' && ele_y_threshold !== false && parseInt(ele_y_threshold)) ? parseInt(ele_y_threshold) : settings.swipe_v_threshold; var origEvent = e.originalEvent; var endEvnt = { 'position': { 'x': (settings.touch_capable) ? origEvent.changedTouches[0].screenX : e.screenX, 'y': (settings.touch_capable) ? origEvent.changedTouches[0].screenY : e.screenY }, 'offset': { 'x': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageX - ($this.offset() ? $this.offset().left : 0)) : Math.round(e.pageX - ($this.offset() ? $this.offset().left : 0)), 'y': (settings.touch_capable) ? Math.round(origEvent.changedTouches[0].pageY - ($this.offset() ? $this.offset().top : 0)) : Math.round(e.pageY - ($this.offset() ? $this.offset().top : 0)) }, 'time': Date.now(), 'target': e.target }; // Read event data into our endEvnt: if (startEvnt.position.y > endEvnt.position.y && (startEvnt.position.y - endEvnt.position.y > v_threshold)) { swipedir = 'swipeup'; } if (startEvnt.position.x < endEvnt.position.x && (endEvnt.position.x - startEvnt.position.x > h_threshold)) { swipedir = 'swiperight'; } if (startEvnt.position.y < endEvnt.position.y && (endEvnt.position.y - startEvnt.position.y > v_threshold)) { swipedir = 'swipedown'; } if (startEvnt.position.x > endEvnt.position.x && (startEvnt.position.x - endEvnt.position.x > h_threshold)) { swipedir = 'swipeleft'; } // Calculate the swipe amount (normalized): var xAmount = Math.abs(startEvnt.position.x - endEvnt.position.x), yAmount = Math.abs(startEvnt.position.y - endEvnt.position.y); var touchData = { 'startEvnt': startEvnt, 'endEvnt': endEvnt, 'direction': swipedir.replace('swipe', ''), 'xAmount': xAmount, 'yAmount': yAmount, 'duration': endEvnt.time - startEvnt.time }; $this.trigger('swipeend', touchData); } started = false; hasSwiped = false; } $this.on(settings.startevent, touchStart); $this.on(settings.moveevent, touchMove); $this.on(settings.endevent, touchEnd); }, remove: function () { $(this).off(settings.startevent, $(this).data.callee1).off(settings.moveevent, $(this).data.callee2).off(settings.endevent, $(this).data.callee3); } }; // scrollstart Event (also handles scrollend): $.event.special.scrollstart = { setup: function () { var thisObject = this, $this = $(thisObject), scrolling, timer; function trigger(event, state) { scrolling = state; triggerCustomEvent(thisObject, scrolling ? 'scrollstart' : 'scrollend', event); } // iPhone triggers scroll after a small delay; use touchmove instead $this.on(settings.scrollevent, function scrollFunc(event) { $this.data('callee', scrollFunc); if (!scrolling) { trigger(event, true); } clearTimeout(timer); timer = setTimeout(function () { trigger(event, false); }, 50); }); }, remove: function () { $(this).off(settings.scrollevent, $(this).data.callee); } }; // This is the orientation change (largely borrowed from jQuery Mobile): var win = $(window), special_event, get_orientation, last_orientation, initial_orientation_is_landscape, initial_orientation_is_default, portrait_map = { '0': true, '180': true }; if (settings.orientation_support) { var ww = window.innerWidth || win.width(), wh = window.innerHeight || win.height(), landscape_threshold = 50; initial_orientation_is_landscape = ww > wh && (ww - wh) > landscape_threshold; initial_orientation_is_default = portrait_map[window.orientation]; if ((initial_orientation_is_landscape && initial_orientation_is_default) || (!initial_orientation_is_landscape && !initial_orientation_is_default)) { portrait_map = { '-90': true, '90': true }; } } $.event.special.orientationchange = special_event = { setup: function () { // If the event is supported natively, return false so that jQuery // will on to the event using DOM methods. if (settings.orientation_support) { return false; } // Get the current orientation to avoid initial double-triggering. last_orientation = get_orientation(); win.on('throttledresize', handler); return true; }, teardown: function () { if (settings.orientation_support) { return false; } win.off('throttledresize', handler); return true; }, add: function (handleObj) { // Save a reference to the bound event handler. var old_handler = handleObj.handler; handleObj.handler = function (event) { event.orientation = get_orientation(); return old_handler.apply(this, arguments); }; } }; // If the event is not supported natively, this handler will be bound to // the window resize event to simulate the orientationchange event. function handler() { // Get the current orientation. var orientation = get_orientation(); if (orientation !== last_orientation) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger("orientationchange"); } } $.event.special.orientationchange.orientation = get_orientation = function () { var isPortrait = true, elem = document.documentElement; if (settings.orientation_support) { isPortrait = portrait_map[window.orientation]; } else { isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1; } return isPortrait ? 'portrait' : 'landscape'; }; // throttle Handler: $.event.special.throttledresize = { setup: function () { $(this).on('resize', throttle_handler); }, teardown: function () { $(this).off('resize', throttle_handler); } }; var throttle = 250, throttle_handler = function () { curr = Date.now(); diff = curr - lastCall; if (diff >= throttle) { lastCall = curr; $(this).trigger('throttledresize'); } else { if (heldCall) { window.clearTimeout(heldCall); } // Promise a held call will still execute heldCall = window.setTimeout(handler, throttle - diff); } }, lastCall = 0, heldCall, curr, diff; // Trigger a custom event: function triggerCustomEvent(obj, eventType, event, touchData) { var originalType = event.type; event.type = eventType; $.event.dispatch.call(obj, event, touchData); event.type = originalType; } // Correctly on anything we've overloaded: $.each({ scrollend: 'scrollstart', swipeup: 'swipe', swiperight: 'swipe', swipedown: 'swipe', swipeleft: 'swipe', swipeend: 'swipe', tap2: 'tap' }, function (e, srcE) { $.event.special[e] = { setup: function () { $(this).on(srcE, $.noop); } }; }); }(jQuery)); if(typeof loadedScripts.extends !== 'undefined') { // ### FUNCTION ############################################# # jQuery.fn.send = function(){ if(!this.length) return this; logging.start('Send'); this.each(function(){ var options = jQuery(this).Data('send',jQuery.fn.send.config); if( options.notice && !jQuery.isFunction(jQuery.notification) ) { alert('Warning: Plugin \'Notification\' is required OR remove \'data-send-notice\'-attribute!'); return false; } if( options.action && options.altenate ) { if( jQuery(options.altenate).find('[rel='+options.action+']').hasAttr('data-send-url') ) { jQuery(this).attr( 'href', jQuery(options.altenate).find('[rel='+options.action+']').attr('data-send-url') ); } jQuery(this).html( jQuery(options.altenate).find('[rel='+options.action+']').html() ); jQuery.proxy( jQuery.fn.send.toggle, this )(); } else jQuery.proxy( jQuery.fn.send.ajax, this )(); }); logging.stop('Send'); }; // ### CONFIG ############################################### # jQuery.fn.send.config = { 'action' : false, 'altenate' : false, 'loading' : true, 'notice' : jQuery.isFunction(jQuery.notification) ? true : false, 'icon' : 'spin7', }; // ### FUNCTION ############################################# # jQuery.fn.send.toggle = function(){ var href = jQuery(this).attr('href').addQuery('special','ajax'), options = jQuery(this).Data('send',jQuery.fn.send.config), icon = jQuery(this).find('.icon').attr('class'); if(href.indexOf('&action=')==-1 && href.indexOf('?action=')==-1) href += '&action=' + options.action; if(options.loading) jQuery(this).find('.icon').attr('class','icon icon-fw icon-spinning icon-'+options.icon); jQuery(this).trigger('nc.send.before'); jQuery.ajax({ context : this, cache : false, dataType: 'json', url : href, success : function(response) { if(options.loading) jQuery(this).find('.icon').attr('class',icon); if(options.notice) jQuery.notification(response.ERROR.name,response.ERROR.title,response.ERROR.msg); if( jQuery(options.altenate).find('[rel='+response.ACTION+']').hasAttr('data-send-url') ) { jQuery(this).attr( 'href', jQuery(options.altenate).find('[rel='+response.ACTION+']').attr('data-send-url') ); } jQuery(this) .attr('data-send-action',response.ACTION) .html(jQuery(options.altenate).find('[rel='+response.ACTION+']').html()) .trigger('nc.send.complete',response) .trigger('nc.send.'+response.ERROR.name,response); } }); return false; }; jQuery.fn.send.ajax = function() { var options = jQuery(this).Data('send',jQuery.fn.send.config), href = options.container || options.url, icon = jQuery(this).find('.icon').attr('class'); if(options.loading) jQuery(this).find('.icon').attr('class','icon icon-fw icon-spinning icon-'+options.icon); jQuery(this).trigger('nc.send.before'); jQuery.ajax({ context : this, cache : false, dataType: 'json', url : href.addQuery('special','ajax'), success : function(response) { if(options.loading) jQuery(this).find('.icon').attr('class',icon); if(options.notice) jQuery.notification(response.ERROR.name,response.ERROR.title,response.ERROR.msg); if(response.REDIRECT) location.href = response.REDIRECT; if(response.RELOAD) location.reload(); if(response.EVAL) eval(response.EVAL); if(response.ERROR) jQuery(this).trigger('nc.send.'+response.ERROR.name,response); jQuery(this).trigger('nc.send.complete',response); } }); return false; }; // ### INITALIZE ############################################ # jQuery(document).on('click','[data-click=send]',function(event){ event.preventDefault(); jQuery(this).send(); }); // ### SET LOADSTATUS ####################################### # loadedScripts.send = true; } else console.error('extends.js is required'); if(typeof loadedScripts.extends !== 'undefined') { // ### FUNCTION ############################################# # jQuery.fn.display = function() { if(!this.length) return this; logging.start('display'); this.each(function(){ var oDisplay = jQuery(this), options = oDisplay.Data('display',jQuery.fn.display.config); if(options.init=='hide') { jQuery(options.container).hide(); } else oDisplay.addClass('active'); if(oDisplay.parents('.pagination').length!=0) { oDisplay.parents('.pagination').pagination(); } jQuery.fn.display.config.hook.forEach(function(hook){ if(oDisplay.is('[data-'+hook+'=display]')) { oDisplay.on(hook,jQuery.display.bind(this,options)); } }); }); logging.stop('display'); return this; }; // ### FUNCTION ############################################# # jQuery.display = function(options,event) { event.stopPropagation(); switch(options.type) { case 'slide': { if(jQuery.ui) jQuery(options.container).toggle('slide', { direction: options.direction }); else jQuery(options.container).slideToggle(); break; } case 'fade' : { jQuery(options.container).fadeToggle(); break; } case 'show' : { jQuery(options.container).toggle(); break; } } switch(self) { case 'slide': { jQuery(this).slideToggle(); break; } case 'fade' : { jQuery(this).fadeToggle(); break; } case 'show' : { jQuery(this).toggle(); break; } } jQuery(this).toggleClass('active'); if(jQuery(this).parents('.pagination').length!=0) { jQuery(this).parents('.pagination').pagination(); } return false; }; // ### CONFIG ############################################### # jQuery.fn.display.config = { 'hook' : ['click','hover','focus','change'], 'init' : 'hide', 'type' : 'slide', 'self' : false, 'direction' : 'up', 'container' : false, }; // ### INITALIZE ############################################ # jQuery.onReadyFirst(function(obj){ jQuery(obj).find('[data-'+jQuery.fn.display.config.hook.join('=display],[data-')+'=display]').display(); }); // ### SET LOADSTATUS ####################################### # loadedScripts.display = true; } else console.error('extends.js is required'); if( typeof loadedScripts.extends !== 'undefined' ) { // ### FUNCTION ############################################# # jQuery.fn.scrollBar = function( refresh ) { if( this.length == 0 ) { return this; } logging.start( 'scrollBar' ); this.each(function() { var options = jQuery(this).Data( 'scroll', jQuery.fn.scrollBar.config ), uniqueID = jQuery(this).setUID( 'scroll' ).getUID( 'scroll' ); if( typeof refresh === 'undefined' ) { jQuery(this) .wrapInner( options.template.content ) .wrapInner( options.template.viewport ) .wrapInner( options.template.overview ) .wrapInner( options.template.wrapper ) .find( '.scroll-wrapper' ) .append( jQuery( options.template.scrollbar ) .append( options.template.track ) .append( options.template.thumb ) ); jQuery(this).find( '.scroll-content' ).resize(function() { jQuery(this).parents( '.scroll' ).scrollBar( true ); }); jQuery(this).find( '.scroll-viewport' ).scroll(function() { var oScroll = jQuery(this).parents( '.scroll' ), oScrollbar = oScroll.find( '.scroll-bar' ), oThumb = oScroll.find( '.scroll-thumb' ), oTrack = oScroll.find( '.scroll-track' ); var options = oScroll.Data( 'scroll', jQuery.fn.scrollBar.config ); if( options.thumb != 'fixed' ) { var height = jQuery(this).height(); scroll = jQuery(this)[0].scrollHeight - jQuery(this).height(), thumb = oTrack.height() * height * 100 / ( height + scroll ) / 100; oThumb.css( 'height', thumb ); } var maxThumb = oTrack.height() - oThumb.height(), maxScroll = jQuery(this)[0].scrollHeight - jQuery(this).height(), posScroll = jQuery(this).scrollTop(), posThumb = maxThumb * ( posScroll * 100 / maxScroll ) / 100; if( posThumb < 0 ) posThumb = 0; if( posThumb > maxThumb ) posThumb = maxThumb; oThumb.css( 'top', posThumb ); }); jQuery(this).find( '.scroll-thumb' ).mousedown(function( event ) { jQuery(this).parents( '.scroll-wrapper' ).addClass( 'scroll-draggable' ); jQuery( 'BODY' ).addClass( 'not-selectable cursor-ns-resize' ); jQuery.fn.scrollBar.cache = { element : jQuery(this), pageX : event.pageX, pageY : event.pageY, position: jQuery(this).position() }; event.preventDefault(); }); } var horizontal = jQuery(this).find( '.scroll-viewport' ).innerWidth() - jQuery(this).find( '.scroll-content' ).outerWidth(true); if( !horizontal ) { horizontal = 20; jQuery(this).find( '.scroll-wrapper' ).removeClass( 'scroll-bar-vertical' ); } else jQuery(this).find( '.scroll-wrapper' ).addClass( 'scroll-bar-vertical' ); jQuery(this).find( '.scroll-viewport' ) .css({ 'width' : 'calc( 100% + ' + horizontal + 'px )', }) .scroll(); }); logging.stop( 'scrollBar' ); return this; }; // ### CACHE ################################################ # jQuery.fn.scrollBar.cache = null; // ### CONFIG ############################################### # jQuery.fn.scrollBar.config = { 'template' : { 'wrapper' : '', 'overview' : '', 'viewport' : '', 'content' : '', 'scrollbar' : '', 'track' : '', 'thumb' : '', }, 'thumb' : "auto", }; // ### INITALIZE ############################################ # jQuery(document) .on( 'ready', function( event ) { jQuery( '.scroll' ).scrollBar(); }) .on( 'mouseup', function( event ) { jQuery( '.scroll-wrapper' ).removeClass( 'scroll-draggable' ); jQuery( 'BODY' ).removeClass( 'not-selectable cursor-ns-resize' ); jQuery.fn.scrollBar.cache = false; event.preventDefault(); }) .on( 'mousemove', function( event ) { if( jQuery.fn.scrollBar.cache ) { var oThumb = jQuery.fn.scrollBar.cache.element, oScroll = oThumb.parents( '.scroll' ), oViewport = oScroll.find( '.scroll-viewport' ), maxThumb = oScroll.find( '.scroll-track' ).height() - oThumb.height(), maxScroll = oViewport[0].scrollHeight - oViewport.height(), posThumb = jQuery.fn.scrollBar.cache.position.top + event.pageY - jQuery.fn.scrollBar.cache.pageY, posScroll = maxScroll * ( posThumb * 100 / maxThumb ) / 100; console.log( maxThumb ); if( posThumb < 0 ) posThumb = 0; if( posThumb > maxThumb ) posThumb = maxThumb; oThumb.css( 'top', posThumb ); if( posScroll < 0 ) posScroll = 0; if( posScroll > maxScroll ) posScroll = maxScroll; oViewport.scrollTop( posScroll ); event.preventDefault(); } }); // ### SET LOADSTATUS ####################################### # loadedScripts.scrollBar = true; } else console.error( 'extends.js is required' ); if( typeof loadedScripts.extends !== 'undefined' ) { // ### FUNCTION ############################################# # jQuery.fn.itemIsotope = function( filter ) { if( this.length == 0 ) { return this; } logging.start( 'itemIsotope' ); this.each(function() { if( jQuery(this).is( '.isotope' ) ) { var sorting = {}; // jQuery(this).find( '.isotope-item' ).each(function() // { // jQuery(this).css({ // width : jQuery(this).width(), // height : jQuery(this).height(), // }); // }); if( !jQuery(this).find( '.isotope-wrapper' ).length ) { jQuery(this).find( '.isotope-item' ).wrapAll( '' ); } if( !jQuery(this).find( '.isotope-filter' ).length ) { jQuery(this).find( '[data-isotope-filter]' ).wrapAll( '' ); } if( !jQuery(this).find( '.isotope-search' ).length ) { jQuery(this).find( '[data-isotope-search]' ).wrapAll( '' ); } jQuery(this).find( '.isotope-item' ).each(function() { for( var data in jQuery(this)[0].dataset ) { if( data.substr( 0, 7 ) == 'isotope' ) { jQuery(this)[0].dataset[data] = jQuery(this)[0].dataset[data].toLowerCase(); } if( data.substr( 0, 14 ) == 'isotopeSorting' ) { sorting[ data.substr( 14 ).toLowerCase() ] = '[data-isotope-sorting-' + data.substr( 14 ).toLowerCase() + ']'; } } }); if( !jQuery(this).is( '[data-isotope-sorting]' ) ) { jQuery(this).attr( 'data-isotope-sorting', JSON.stringify( sorting ) ); } } var oIsotope = jQuery(this).closest( '.isotope' ), oWrapper = oIsotope.find( '.isotope-wrapper' ), oFilter = oIsotope.find( '.isotope-filter' ), oSearch = oIsotope.find( '.isotope-search' ); var options = oIsotope.Data( 'isotope', jQuery.fn.itemIsotope.config ), options = jQuery(this).Data( 'isotope', options ), uniqueID = oIsotope.setUID( 'isotope' ).getUID( 'isotope' ); oFilter.find( '[data-isotope-filter]').removeClass( 'active' ); if( options.search && jQuery(this).val() ) { options.filter = '[data-isotope-search-' + options.search + '*="' + jQuery(this).val().toLowerCase() + '"]'; } else { oSearch.find( ' :INPUT' ).val(''); oFilter.find( '[data-isotope-filter="' + options.filter + '"]').addClass( 'active' ); } if( oWrapper.data('isotope') ) { oWrapper.isotope('updateSortData'); } oWrapper.isotope({ itemSelector : '.isotope-item', filter : options.filter, sortBy : options.orderby, masonry : { columnWidth : options.size, }, getSortData : JSON.parse( options.sorting ), sortAscending : options.order == 'asc', }); // console.log( options ); }); logging.stop( 'itemIsotope' ); return this; }; // ### CONFIG ############################################### # jQuery.fn.itemIsotope.config = { 'filter' : '*', 'search' : false, 'size' : '.isotope-item', 'order' : 'desc', 'orderby' : 'date', 'sorting' : {}, }; // ### INCLUDES ############################################# # /*! * Isotope PACKAGED v2.2.0 * * Licensed GPLv3 for open source use * or Isotope Commercial License for commercial use * * http://isotope.metafizzy.co * Copyright 2015 Metafizzy */ !function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c("object"==typeof exports?require("jquery"):a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(window),function(){"use strict";function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b1){var L=void 0,I=void 0,D=void 0;"column"===e.slidesPerColumnFill?(D=P-(I=Math.floor(P/M))*M,(I>k||I===k&&D===M-1)&&(D+=1)>=M&&(D=0,I+=1),L=I+D*T/M,$.css({"-webkit-box-ordinal-group":L,"-moz-box-ordinal-group":L,"-ms-flex-order":L,"-webkit-order":L,order:L})):I=P-(D=Math.floor(P/z))*z,$.css("margin-"+(this.isHorizontal()?"top":"left"),0!==D&&e.spaceBetween&&e.spaceBetween+"px").attr("data-swiper-column",I).attr("data-swiper-row",D)}if("none"!==$.css("display")){if("auto"===e.slidesPerView){var O=t.getComputedStyle($[0],null),A=$[0].style.transform,G=$[0].style.webkitTransform;A&&($[0].style.transform="none"),G&&($[0].style.webkitTransform="none"),S=this.isHorizontal()?$[0].getBoundingClientRect().width+parseFloat(O.getPropertyValue("margin-left"))+parseFloat(O.getPropertyValue("margin-right")):$[0].getBoundingClientRect().height+parseFloat(O.getPropertyValue("margin-top"))+parseFloat(O.getPropertyValue("margin-bottom")),A&&($[0].style.transform=A),G&&($[0].style.webkitTransform=G),e.roundLengths&&(S=Math.floor(S))}else S=(s-(e.slidesPerView-1)*w)/e.slidesPerView,e.roundLengths&&(S=Math.floor(S)),l[P]&&(this.isHorizontal()?l[P].style.width=S+"px":l[P].style.height=S+"px");l[P]&&(l[P].swiperSlideSize=S),v.push(S),e.centeredSlides?(y=y+S/2+x/2+w,0===x&&0!==P&&(y=y-s/2-w),0===P&&(y=y-s/2-w),Math.abs(y)<.001&&(y=0),e.roundLengths&&(y=Math.floor(y)),E%e.slidesPerGroup==0&&c.push(y),u.push(y)):(e.roundLengths&&(y=Math.floor(y)),E%e.slidesPerGroup==0&&c.push(y),u.push(y),y=y+S+w),this.virtualSize+=S+w,x=S,E+=1}}if(this.virtualSize=Math.max(this.virtualSize,s)+m,a&&r&&("slide"===e.effect||"coverflow"===e.effect)&&i.css({width:this.virtualSize+e.spaceBetween+"px"}),h.flexbox&&!e.setWrapperSize||(this.isHorizontal()?i.css({width:this.virtualSize+e.spaceBetween+"px"}):i.css({height:this.virtualSize+e.spaceBetween+"px"})),e.slidesPerColumn>1&&(this.virtualSize=(S+e.spaceBetween)*T,this.virtualSize=Math.ceil(this.virtualSize/e.slidesPerColumn)-e.spaceBetween,this.isHorizontal()?i.css({width:this.virtualSize+e.spaceBetween+"px"}):i.css({height:this.virtualSize+e.spaceBetween+"px"}),e.centeredSlides)){C=[];for(var H=0;H (this.snapGrid[a+1]-n)/2&&(s=this.params.slidesPerGroup)}return this.slideTo(s,e,t,i)},slideToClickedSlide:function(){var e,t=this,i=t.params,a=t.$wrapperEl,r="auto"===i.slidesPerView?t.slidesPerViewDynamic():i.slidesPerView,n=t.clickedIndex;if(i.loop){if(t.animating)return;e=parseInt(s(t.clickedSlide).attr("data-swiper-slide-index"),10),i.centeredSlides?n=s[p]&&i=s[p]&&(h=p);r.normalizeSlideIndex&&(h<0||void 0===h)&&(h=0)}if((t=a.indexOf(i)>=0?a.indexOf(i):Math.floor(h/r.slidesPerGroup))>=a.length&&(t=a.length-1),h!==n){var c=parseInt(this.slides.eq(h).attr("data-swiper-slide-index")||h,10);d.extend(this,{snapIndex:t,realIndex:c,previousIndex:n,activeIndex:h}),this.emit("activeIndexChange"),this.emit("snapIndexChange"),o!==c&&this.emit("realIndexChange"),this.emit("slideChange")}else t!==l&&(this.snapIndex=t,this.emit("snapIndexChange"))},updateClickedSlide:function(e){var t=this.params,i=s(e.target).closest("."+t.slideClass)[0],a=!1;if(i)for(var r=0;r=o.length&&(u=o.length-1),(p||n.initialSlide||0)===(d||0)&&i&&a.emit("beforeSlideChangeStart");var v,f=-o[u];if(a.updateProgress(f),n.normalizeSlideIndex)for(var m=0;m