// https://github.com/dankogai/js-base64 (function(global){"use strict";var _base64=global.base64;var version="2.1.9";var buffer;if(typeof module!=="undefined"&&module.exports){try{buffer=require("buffer").buffer}catch(err){}}var b64chars="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/";var b64tab=function(bin){var t={};for(var i=0,l=bin.length;i>>6)+fromcharcode(128|cc&63):fromcharcode(224|cc>>>12&15)+fromcharcode(128|cc>>>6&63)+fromcharcode(128|cc&63)}else{var cc=65536+(c.charcodeat(0)-55296)*1024+(c.charcodeat(1)-56320);return fromcharcode(240|cc>>>18&7)+fromcharcode(128|cc>>>12&63)+fromcharcode(128|cc>>>6&63)+fromcharcode(128|cc&63)}};var re_utob=/[\ud800-\udbff][\udc00-\udffff]|[^\x00-\x7f]/g;var utob=function(u){return u.replace(re_utob,cb_utob)};var cb_encode=function(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charcodeat(0)<<16|(ccc.length>1?ccc.charcodeat(1):0)<<8|(ccc.length>2?ccc.charcodeat(2):0),chars=[b64chars.charat(ord>>>18),b64chars.charat(ord>>>12&63),padlen>=2?"=":b64chars.charat(ord>>>6&63),padlen>=1?"=":b64chars.charat(ord&63)];return chars.join("")};var btoa=global.btoa?function(b){return global.btoa(b)}:function(b){return b.replace(/[\s\s]{1,3}/g,cb_encode)};var _encode=buffer?function(u){return(u.constructor===buffer.constructor?u:new buffer(u)).tostring("base64")}:function(u){return btoa(utob(u))};var encode=function(u,urisafe){return!urisafe?_encode(string(u)):_encode(string(u)).replace(/[+\/]/g,function(m0){return m0=="+"?"-":"_"}).replace(/=/g,"")};var encodeuri=function(u){return encode(u,true)};var re_btou=new regexp(["[à-ß][€-¿]","[à-ï][€-¿]{2}","[ð-÷][€-¿]{3}"].join("|"),"g");var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=(7&cccc.charcodeat(0))<<18|(63&cccc.charcodeat(1))<<12|(63&cccc.charcodeat(2))<<6|63&cccc.charcodeat(3),offset=cp-65536;return fromcharcode((offset>>>10)+55296)+fromcharcode((offset&1023)+56320);case 3:return fromcharcode((15&cccc.charcodeat(0))<<12|(63&cccc.charcodeat(1))<<6|63&cccc.charcodeat(2));default:return fromcharcode((31&cccc.charcodeat(0))<<6|63&cccc.charcodeat(1))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var cb_decode=function(cccc){var len=cccc.length,padlen=len%4,n=(len>0?b64tab[cccc.charat(0)]<<18:0)|(len>1?b64tab[cccc.charat(1)]<<12:0)|(len>2?b64tab[cccc.charat(2)]<<6:0)|(len>3?b64tab[cccc.charat(3)]:0),chars=[fromcharcode(n>>>16),fromcharcode(n>>>8&255),fromcharcode(n&255)];chars.length-=[0,0,2,1][padlen];return chars.join("")};var atob=global.atob?function(a){return global.atob(a)}:function(a){return a.replace(/[\s\s]{1,4}/g,cb_decode)};var _decode=buffer?function(a){return(a.constructor===buffer.constructor?a:new buffer(a,"base64")).tostring()}:function(a){return btou(atob(a))};var decode=function(a){return _decode(string(a).replace(/[-_]/g,function(m0){return m0=="-"?"+":"/"}).replace(/[^a-za-z0-9\+\/]/g,""))};var noconflict=function(){var base64=global.base64;global.base64=_base64;return base64};global.base64={version:version,atob:atob,btoa:btoa,frombase64:decode,tobase64:encode,utob:utob,encode:encode,encodeuri:encodeuri,btou:btou,decode:decode,noconflict:noconflict};if(typeof object.defineproperty==="function"){var noenum=function(v){return{value:v,enumerable:false,writable:true,configurable:true}};global.base64.extendstring=function(){object.defineproperty(string.prototype,"frombase64",noenum(function(){return decode(this)}));object.defineproperty(string.prototype,"tobase64",noenum(function(urisafe){return encode(this,urisafe)}));object.defineproperty(string.prototype,"tobase64uri",noenum(function(){return encode(this,true)}))}}if(global["meteor"]){base64=global.base64}})(this); $(function() { /** * set required fields, add star class to them. * * @access public * @return void */ var setrequiredfields = function() { if(!config || !config.requiredfields) return; var requiredfields = config.requiredfields.split(','); for(i = 0; i < requiredfields.length; i++) { var $field = $('#' + requiredfields[i]); $field.closest('td,th').prepend("
"); $field.closest('.form-group').addclass('required'); if(window.v && window.v.lang.required) { $field.attr('placeholder', '(' + window.v.lang.required + ') ' + ($field.attr('placeholder') || '')); } } }; // set required feilds in form setrequiredfields(); // make company links on app navbar as modaltrigger to open content with modal $('#appnav .nav-system-company a, #appnav a[data-toggle="modal"]').modaltrigger(); // set active item on #appnav var $appnav = $('#appnav'); var activednav = v.activednav; if(!activednav) { if(config && config.currentmodule) { var modulename = config.currentmodule; if(modulename === 'article' || modulename === 'product' || modulename === 'blog') { var lifinded = false; $appnav.find('li > a').each(function() { var $a = $(this); var href = $a.attr('href'), $li = $a.parents('li'), pathname = document.location.pathname; var hrefindex = href.indexof(pathname); if(href !== '/' && hrefindex === 0 && !$li.hasclass('active')) { $li.addclass('active'); lifinded = true; } }); if(!lifinded) activednav = '.nav-' + modulename + '-0'; } else activednav = '.nav-system-' + (modulename === 'index' ? 'home' : modulename); } } $appnav.find(activednav).addclass('active'); // init deleter $(document).on('click', '.deleter', function(e) { var $this = $(this); var options = $.extend({url: $this.attr('href'), confirm: window.v.lang.confirmdelete}, $this.data()); e.preventdefault(); $.ajaxaction(options, $this); }); function tidycardsrow($row) { var $cards = $row.children('.col'); if($cards.length < 2) { $cards.css('width', '100%'); return; } var contentheight = 0, minimgheight = 9999, maximgheight = 0; var width = 100.0 / $cards.length; $cards.each(function() { var $col = $(this).css('width', width + '%'); contentheight = math.max(contentheight, $col.find('.card-content').height()); var $img = $col.find('.card-img').css('height', 'auto'); var imgheight = $img.height(); if(!$img.find('.media-placeholder').length) minimgheight = math.min(minimgheight, imgheight); maximgheight = math.max(maximgheight, imgheight); }); if(minimgheight === 9999) return; $cards.find('.card-content').css('height', contentheight); if(minimgheight > 20) { $cards.find('.card-img').css({'height': minimgheight}) .find('.media-placeholder').css({'height': minimgheight, 'line-height': minimgheight + 'px'}); } if(maximgheight !== minimgheight || minimgheight <= 20) {settimeout(function(){tidycardsrow($row);}, 500);} }; $.fn.tidycards = function() { return $(this).each(function() { $(this).children('.row').each(function(){tidycardsrow($(this));}); }); }; $('.cards-products').tidycards(); $(window).on('lazyloaded', function(e, $img) { var $row = $img.closest('.row'); if($row.parent().hasclass('cards-products')) tidycardsrow($row); }) }); function appendfingerprint(form) { if(form.data('checkfingerprint')) { var fingerprint = getfingerprint(); if(form.find('#fingerprint').size() == 0) { form.append(""); } else { $('#fingerprint').val(fingerprint); } } } function getfingerprint() { if(typeof(fingerprint) == 'function') return new fingerprint().get(); var fingerprint = ''; $.each(navigator, function(key, value) { if(typeof(value) == 'string') fingerprint += value.length; }) return fingerprint; }