PHP Classes

File: CMF/Web/scripts/customer_common.js

Recommend this page to a friend!
  Classes of Burge Lab   BurgeATS   CMF/Web/scripts/customer_common.js   Download  
File: CMF/Web/scripts/customer_common.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: BurgeATS
CRM, Ticketing system, and employee manangement
Author: By
Last change: Update of CMF/Web/scripts/customer_common.js
Date: 1 year ago
Size: 11,379 bytes
 

Contents

Class file image Download
function correctPersianDigits(val) { var a=['?','?','?','?','?','?','?','?','?','?']; var b=''; for(var j=0; j<val.length;j++) { var c=a.indexOf(val[j]); if(c>=0) b+=''+c; else b+=val[j]; } return b; } //trim for IE<=8 if(typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } } $(window).load(function() { $(".disable-new-line").keydown(function(e) { if (e.keyCode == 13) { e.preventDefault(); return false; } }); windowResizedDefault(); $(window).on('resize',windowResizedDefault); changeGraphicalCheckBoxes(); lazyLoader(); //Google Analytics var loc=document.location.pathname; if(0) if( (loc == '/') || loc.startsWith("/post-") || loc.startsWith("/product-") || loc.startsWith("/category-") || loc.startsWith("/pcategory-") ) setTimeout(function(){ $(document.body).append($("<script src='https://www.googletagmanager.com/gtag/js?id=GAID'></script>")); setTimeout(function() { window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GAID'); },3000); },5000); }); function changeGraphicalCheckBoxes() { if(!($.browser.msie && (parseInt($.browser.version) < 10))) $("input[type=checkbox].graphical").each( function(index,el) { setCheckBoxGraphical(el); } ); } function setCheckBoxGraphical(el) { var html=$(el).clone().wrapAll('<div>').parent().html(); var html='<div class="checkbox-holder">'+html+'<label><i></i></label></div>'; $(el).replaceWith(html); } function windowResizedDefault() { var winWidth=$(window).width(); var winHeight=$(window).height(); $(".side-menu").css("min-height","auto"); $(".side-menu .mobile .click").unbind("click"); $(".main").css("min-height",winHeight); if(winWidth<=600) { $(".main").css("min-height"); $(".side-menu .mobile .click").click(function() { $(".side-menu ul").toggleClass("active"); }); } else { $(".side-menu").css("min-height",winHeight); } return; } windowResizedDefault(); //lazy loader //loads all images and background images //with data-ll-url and data-ll-type props //after document loaded completely, so decreases page load time function lazyLoader() { var images=$(".lazy-load"); var imageIndex=-1; loadNext(); var el; var url; function loadNext() { imageIndex++; if(imageIndex === images.length) { return; } el=$(images[imageIndex]); url=el.data('ll-url'); url=url.replace(/https?\:\/\//g,'//'); $.get(url, function() { switch(el.data('ll-type')) { case "background-image": el.css("background-image","url('"+url+"')"); break; case "src": el.prop("src",url); break; } }).always(loadNext); } } /*! * jQuery Browser Plugin 0.0.8 * https://github.com/gabceb/jquery-browser-plugin * * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors * http://jquery.org/license * * Modifications Copyright 2015 Gabriel Cebrian * https://github.com/gabceb * * Released under the MIT license * * Date: 05-07-2015 */ /*global window: false */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], function ($) { return factory($); }); } else if (typeof module === 'object' && typeof module.exports === 'object') { // Node-like environment module.exports = factory(require('jquery')); } else { // Browser globals factory(window.jQuery); } }(function(jQuery) { "use strict"; function uaMatch( ua ) { // If an UA is not provided, default to the current browser UA. if ( ua === undefined ) { ua = window.navigator.userAgent; } ua = ua.toLowerCase(); var match = /(edge)\/([\w.]+)/.exec( ua ) || /(opr)[\/]([\w.]+)/.exec( ua ) || /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; var platform_match = /(ipad)/.exec( ua ) || /(ipod)/.exec( ua ) || /(iphone)/.exec( ua ) || /(kindle)/.exec( ua ) || /(silk)/.exec( ua ) || /(android)/.exec( ua ) || /(windows phone)/.exec( ua ) || /(win)/.exec( ua ) || /(mac)/.exec( ua ) || /(linux)/.exec( ua ) || /(cros)/.exec( ua ) || /(playbook)/.exec( ua ) || /(bb)/.exec( ua ) || /(blackberry)/.exec( ua ) || []; var browser = {}, matched = { browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "", version: match[ 2 ] || match[ 4 ] || "0", versionNumber: match[ 4 ] || match[ 2 ] || "0", platform: platform_match[ 0 ] || "" }; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; browser.versionNumber = parseInt(matched.versionNumber, 10); } if ( matched.platform ) { browser[ matched.platform ] = true; } // These are all considered mobile platforms, meaning they run a mobile browser if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone || browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) { browser.mobile = true; } // These are all considered desktop platforms, meaning they run a desktop browser if ( browser.cros || browser.mac || browser.linux || browser.win ) { browser.desktop = true; } // Chrome, Opera 15+ and Safari are webkit based browsers if ( browser.chrome || browser.opr || browser.safari ) { browser.webkit = true; } // IE11 has a new token so we will assign it msie to avoid breaking changes // IE12 disguises itself as Chrome, but adds a new Edge token. if ( browser.rv || browser.edge ) { var ie = "msie"; matched.browser = ie; browser[ie] = true; } // Blackberry browsers are marked as Safari on BlackBerry if ( browser.safari && browser.blackberry ) { var blackberry = "blackberry"; matched.browser = blackberry; browser[blackberry] = true; } // Playbook browsers are marked as Safari on Playbook if ( browser.safari && browser.playbook ) { var playbook = "playbook"; matched.browser = playbook; browser[playbook] = true; } // BB10 is a newer OS version of BlackBerry if ( browser.bb ) { var bb = "blackberry"; matched.browser = bb; browser[bb] = true; } // Opera 15+ are identified as opr if ( browser.opr ) { var opera = "opera"; matched.browser = opera; browser[opera] = true; } // Stock Android browsers are marked as Safari on Android. if ( browser.safari && browser.android ) { var android = "android"; matched.browser = android; browser[android] = true; } // Kindle browsers are marked as Safari on Kindle if ( browser.safari && browser.kindle ) { var kindle = "kindle"; matched.browser = kindle; browser[kindle] = true; } // Kindle Silk browsers are marked as Safari on Kindle if ( browser.safari && browser.silk ) { var silk = "silk"; matched.browser = silk; browser[silk] = true; } // Assign the name and platform variable browser.name = matched.browser; browser.platform = matched.platform; return browser; } // Run the matching process, also assign the function to the returned object // for manual, jQuery-free use if desired window.jQBrowser = uaMatch( window.navigator.userAgent ); window.jQBrowser.uaMatch = uaMatch; // Only assign to jQuery.browser if jQuery is loaded if ( jQuery ) { jQuery.browser = window.jQBrowser; } return window.jQBrowser; })); /* jQuery-FontSpy.js v3.0.0 * https://github.com/patrickmarabeas/jQuery-FontSpy.js * * Copyright 2013, Patrick Marabeas http://pulse-dev.com * Released under the MIT license * http://opensource.org/licenses/mit-license.php * * Date: 02/11/2015 */ (function( w, $ ) { fontSpy = function ( fontName, conf ) { var $html = $('html'), $body = $('body'), fontFamilyName = fontName; // Throw error if fontName is not a string or not is left as an empty string if (typeof fontFamilyName !== 'string' || fontFamilyName === '') { throw 'A valid fontName is required. fontName must be a string and must not be an empty string.'; } var defaults = { font: fontFamilyName, fontClass: fontFamilyName.toLowerCase().replace( /\s/g, '' ), success: function() {}, failure: function() {}, testFont: 'Courier New', testString: 'QW@HhsXJ', glyphs: '', delay: 50, timeOut: 1000, callback: $.noop }; var config = $.extend( defaults, conf ); var $tester = $('<span>' + config.testString+config.glyphs + '</span>') .css('position', 'absolute') .css('top', '-9999px') .css('left', '-9999px') .css('visibility', 'hidden') .css('fontFamily', config.testFont) .css('fontSize', '250px'); $body.append($tester); var fallbackFontWidth = $tester.outerWidth(); $tester.css('fontFamily', config.font + ',' + config.testFont); var failure = function () { $html.addClass("no-"+config.fontClass); if( config && config.failure ) { config.failure(); } config.callback(new Error('FontSpy timeout')); $tester.remove(); }; var success = function () { config.callback(); $html.addClass(config.fontClass); if( config && config.success ) { config.success(); } $tester.remove(); }; var retry = function () { setTimeout(checkFont, config.delay); config.timeOut = config.timeOut - config.delay; }; var checkFont = function () { var loadedFontWidth = $tester.outerWidth(); if (fallbackFontWidth !== loadedFontWidth){ success(); } else if(config.timeOut < 0) { failure(); } else { retry(); } } checkFont(); } })( this, jQuery ); //using fontSpy: /* fontSpy('koodak', { glyphs: '\ue81a\ue82d\ue823', failure: function() { fontSpy('b koodak', { glyphs: '\ue81a\ue82d\ue823', failure: function() { $("body").append('<style type="text/css"> * { font-family: OnLineKoodak, tahoma;}</style>') } }); } }); */