2016-11-06 02:19:47 +00:00
$ ( function ( ) { $ . ajaxSetup ( { "url" : PF . obj . config . json _api , "cache" : false , "dataType" : "json" , "data" : { auth _token : PF . obj . config . auth _token } } ) ; $ ( window ) . bind ( "beforeunload" , function ( ) { if ( $ ( "form" , PF . obj . modal . selectors . root ) . data ( "beforeunload" ) == "continue" ) return ; if ( $ ( PF . obj . modal . selectors . root ) . is ( ":visible" ) && PF . fn . form _modal _has _changed ( ) ) { return PF . fn . _s ( "All the changes that you have made will be lost if you continue." ) ; } } ) ; $ ( window ) . bind ( "hashchange" , function ( ) { if ( window . location . hash == "#edit" && ! $ ( PF . obj . modal . selectors . root ) . exists ( ) ) $ ( "[data-modal=edit]" ) . first ( ) . click ( ) ; } ) ; PF . fn . bindtipTip ( ) ; var resizeTimer , scrollTimer , width = $ ( window ) . width ( ) ; $ ( window ) . on ( "resize" , function ( ) { PF . fn . growl . fixPosition ( ) ; PF . fn . modal . fixScrollbars ( ) ; var device = PF . fn . getDeviceName ( ) , handled = [ "phone" , "phablet" ] , desktop = [ "tablet" , "laptop" , "desktop" ] ; clearTimeout ( resizeTimer ) ; clearTimeout ( scrollTimer ) ; scrollTimer = setTimeout ( function ( ) { $ ( ".follow-scroll-wrapper, .follow-scroll-placeholder" ) . css ( { minHeight : "" } ) ; PF . obj . follow _scroll . set ( true ) ; PF . obj . follow _scroll . process ( true ) ; } , 100 ) ; var new _device = PF . fn . getDeviceName ( ) ; if ( new _device !== device && ( $ . inArray ( device , handled ) >= 0 && $ . inArray ( new _device , handled ) == - 1 ) || ( $ . inArray ( device , desktop ) >= 0 && $ . inArray ( new _device , desktop ) == - 1 ) ) { PF . fn . close _pops ( ) ; }
2016-08-18 20:39:31 +00:00
$ ( ".top-bar" ) . css ( "top" , "" ) ; $ ( PF . fn . topMenu . vars . menu ) . css ( "height" , $ ( window ) . height ( ) ) ; $ ( "body" ) . css ( { position : "" , height : "" } ) ; $ ( ".antiscroll" ) . removeClass ( "jsly" ) . data ( "antiscroll" , "" ) ; $ ( ".antiscroll-inner" ) . css ( { height : "" , width : "" , maxheight : "" } ) ; PF . fn . list _fluid _width ( ) ; if ( width !== $ ( window ) . width ( ) ) { if ( $ ( "[data-action=top-bar-menu-full]" , "#top-bar" ) . hasClass ( "current" ) ) { PF . fn . topMenu . hide ( 0 ) ; }
var cols _fn = function ( ) { PF . fn . listing . columnizer ( true , 0 ) ; $ ( PF . obj . listing . selectors . list _item ) . show ( ) ; } ; cols _fn ( ) ; }
2016-11-06 02:19:47 +00:00
width = $ ( window ) . width ( ) ; } ) ; $ ( document ) . on ( "click" , "html" , function ( ) { PF . fn . close _pops ( ) ; } ) ; if ( $ ( "html" ) . hasClass ( "no-svg" ) ) { $ ( "img.replace-svg" ) . replace _svg ( ) ; }
2016-08-18 20:39:31 +00:00
$ ( document ) . on ( "keydown" , ".numeric-input" , function ( e ) { e . keydown _numeric ( ) ; } ) ; $ ( document ) . on ( "click" , "[data-scrollto]" , function ( e ) { var target = $ ( this ) . data ( "scrollto" ) , $target = $ ( ! target . match ( /^\#|\./ ) ? "#" + target : target ) ; if ( $target . exists ( ) ) { PF . fn . scroll ( $target ) ; } else { console . log ( "PF scrollto error: target doesn't exists" , $target ) ; } } ) ; $ ( document ) . on ( "click" , "[data-trigger]" , function ( e ) { var trigger = $ ( this ) . data ( "trigger" ) , $target = $ ( ! trigger . match ( /^\#|\./ ) ? "#" + trigger : trigger ) ; if ( $target . exists ( ) ) { e . stopPropagation ( ) ; e . preventDefault ( ) ; if ( ! $target . closest ( PF . obj . modal . selectors . root ) . length ) { PF . fn . modal . close ( ) ; }
$target . click ( ) ; } else { console . log ( "PF trigger error: target doesn't exists" , $target ) ; } } ) ; $ ( "form[method=post]" ) . each ( function ( ) { if ( ! $ ( "input[name=auth_token]" , this ) . exists ( ) ) { $ ( this ) . append ( $ ( '<input>' , { type : 'hidden' , name : "auth_token" , value : PF . obj . config . auth _token } ) ) ; } } ) ; $ ( document ) . on ( "click" , ".clear-form" , function ( ) { $ ( this ) . closest ( "form" ) [ 0 ] . reset ( ) ; } ) ; $ ( document ) . on ( "submit" , "form[data-action=validate]" , function ( e ) { var type = $ ( this ) . data ( "type" ) , errors = false , $validate = $ ( this ) . find ( "[required], [data-validate]" ) ; $validate . each ( function ( ) { var input _type = $ ( this ) . attr ( "type" ) , pattern = $ ( this ) . attr ( "pattern" ) , errorFn = function ( el ) { $ ( el ) . highlight ( ) ; errors = true ; } ; if ( $ ( this ) . is ( "[required]" ) && $ ( this ) . val ( ) == "" ) { if ( $ ( this ) . is ( ":hidden" ) ) { var $hidden _target = $ ( $ ( $ ( this ) . data ( "highlight" ) ) . exists ( ) ? $ ( this ) . data ( "highlight" ) : "#" + $ ( this ) . data ( "highlight" ) ) ; $ ( $hidden _target ) . highlight ( ) ; }
errorFn ( this ) ; }
if ( typeof pattern == "undefined" && /mail|url/ . test ( input _type ) == false ) { return true ; }
if ( pattern ) { pattern = new RegExp ( pattern ) ; if ( ! pattern . test ( $ ( this ) . val ( ) ) ) { errorFn ( this ) ; } }
if ( input _type == "email" && ! $ ( this ) . val ( ) . isEmail ( ) ) { errorFn ( this ) ; } } ) ; if ( errors ) { PF . fn . growl . expirable ( PF . fn . _s ( "Check the errors in the form to continue." ) ) ; return false ; } } ) ; $ ( document ) . on ( "change" , "select[data-combo]" , function ( ) { var $combo = $ ( "#" + $ ( this ) . data ( "combo" ) ) ; if ( $combo . exists ( ) ) { $combo . children ( ".switch-combo" ) . hide ( ) ; }
var $combo _container = $ ( "#" + $ ( this ) . closest ( "select" ) . data ( "combo" ) ) , $combo _target = $ ( "[data-combo-value~=" + $ ( "option:selected" , this ) . attr ( "value" ) + "]" , $combo _container ) ; if ( $combo _target . exists ( ) ) { $combo _target . show ( ) . find ( "[data-required]" ) . each ( function ( ) { $ ( this ) . attr ( "required" , "required" ) ; } ) ; }
$ ( ".switch-combo" , $combo _container ) . each ( function ( ) { if ( $ ( this ) . is ( ":visible" ) ) return ; $ ( "[required]" , this ) . attr ( "data-required" , true ) . removeAttr ( "required" ) ; } ) ; } ) ; $ ( document ) . on ( "keyup" , function ( e ) { $this = $ ( e . target ) ; if ( e . keyCode == 27 ) { if ( $ ( PF . obj . modal . selectors . root ) . is ( ":visible" ) && ! $this . is ( ":input" ) ) { $ ( "[data-action=cancel],[data-action=close-modal]" , PF . obj . modal . selectors . root ) . first ( ) . click ( ) ; } } } ) ; $ ( document ) . on ( "change" , ":input" , function ( e ) { PF . fn . growl . close ( ) ; } ) ; $ ( document ) . on ( "keyup" , ":input" , function ( e ) { $ ( ".input-warning" , $ ( this ) . closest ( ".input-label" ) ) . html ( "" ) ; } ) ; $ ( document ) . on ( "blur" , ":input" , function ( ) { var this _val = $ . trim ( $ ( this ) . prop ( "value" ) ) ; $ ( this ) . prop ( "value" , this _val ) ; } ) ; $ ( document ) . on ( "click" , ":input[data-focus=select-all]" , function ( ) { this . select ( ) ; } ) ; $ ( document ) . on ( "keyup change blur" , ":input[type=password]" , function ( ) { var password = testPassword ( $ ( this ) . val ( ) ) , $parent = $ ( this ) . closest ( "div" ) ; if ( $ ( this ) . val ( ) == "" ) { password . percent = 0 ; password . verdict = "" ; }
$ ( "[data-content=password-meter-bar]" , $parent ) . width ( password . percent ) ; $ ( "[data-text=password-meter-message]" , $parent ) . removeClass ( "red-warning" ) . text ( password . verdict !== "" ? PF . fn . _s ( password . verdict ) : "" ) ; } ) ; $ ( document ) . on ( "click" , "[rel=popup-link], .popup-link" , function ( e ) { e . preventDefault ( ) ; var href = $ ( this ) [ typeof $ ( this ) . attr ( "href" ) !== "undefined" ? "attr" : "data" ] ( "href" ) ; if ( typeof href == "undefined" ) { return ; }
if ( href . substring ( 0 , 6 ) == "mailto" && PF . fn . isDevice ( [ "phone" , "phablet" ] ) ) { window . location = href ; return false ; }
PF . fn . popup ( { href : href } ) ; } ) ; $ ( window ) . scroll ( function ( ) { PF . obj . follow _scroll . process ( ) ; } ) ; $ ( document ) . on ( "click" , "[data-modal=simple],[data-modal=html]" , function ( ) { var $target = $ ( "[data-modal=" + $ ( this ) . data ( "target" ) + "], #" + $ ( this ) . data ( "target" ) ) . first ( ) ; PF . fn . modal . call ( { template : $target . html ( ) , buttons : false } ) ; } ) ; $ ( document ) . on ( "submit" , PF . obj . modal . selectors . root + " form" , function ( e ) { if ( $ ( this ) . data ( "prevented" ) ) return false ; if ( typeof $ ( this ) . attr ( "method" ) !== "undefined" ) return ; return false ; } ) ; $ ( document ) . on ( "click" , "[data-modal=edit],[data-modal=form],[data-confirm]" , function ( e ) { e . preventDefault ( ) ; var $this = $ ( this ) , $target , submit _function , cancel _function , onload _function , submit _done _msg ; if ( $this . is ( "[data-confirm]" ) ) { $target = $this ; PF . obj . modal . type = "confirm" ; } else { $target = $ ( "[data-modal=" + $this . data ( "target" ) + "], #" + $this . data ( "target" ) ) . first ( ) ; if ( $target . length == 0 ) { $target = $ ( "[data-modal=form-modal], #form-modal" ) . first ( ) ; }
if ( $target . length == 0 ) { console . log ( "PF Error: Modal target doesn't exists." ) ; }
PF . obj . modal . type = $this . data ( "modal" ) ; }
var args = $this . data ( "args" ) , submit _function = window [ $target . data ( "submit-fn" ) ] , cancel _function = window [ $target . data ( "cancel-fn" ) ] , onload _function = window [ $target . data ( "load-fn" ) ] , submit _done _msg = $target . data ( "submit-done" ) , ajax = { url : $target . data ( "ajax-url" ) , deferred : window [ $target . data ( "ajax-deferred" ) ] } ; if ( typeof submit _function !== "function" && $target . data ( "submit-fn" ) ) { var submit _fn _split = $target . data ( "submit-fn" ) . split ( "." ) ; submit _function = window ; for ( var i = 0 ; i < submit _fn _split . length ; i ++ ) { submit _function = submit _function [ submit _fn _split [ i ] ] ; } }
if ( typeof cancel _function !== "function" && $target . data ( "cancel-fn" ) ) { var cancel _fn _split = $target . data ( "cancel-fn" ) . split ( "." ) ; cancel _function = window ; for ( var i = 0 ; i < cancel _fn _split . length ; i ++ ) { cancel _function = cancel _function [ cancel _fn _split [ i ] ] ; } }
if ( typeof load _function !== "function" && $target . data ( "load-fn" ) ) { var load _fn _split = $target . data ( "load-fn" ) . split ( "." ) ; load _function = window ; for ( var i = 0 ; i < load _fn _split . length ; i ++ ) { load _function = load _function [ load _fn _split [ i ] ] ; } }
if ( typeof ajax . deferred !== "object" && $target . data ( "ajax-deferred" ) ) { var deferred _obj _split = $target . data ( "ajax-deferred" ) . split ( "." ) ; ajax . deferred = window ; for ( var i = 0 ; i < deferred _obj _split . length ; i ++ ) { ajax . deferred = ajax . deferred [ deferred _obj _split [ i ] ] ; } }
var fn _before = window [ $target . data ( "before-fn" ) ] ; if ( typeof fn _before !== "function" && $target . data ( "before-fn" ) ) { var before _obj _split = $target . data ( "before-fn" ) . split ( "." ) ; fn _before = window ; for ( var i = 0 ; i < before _obj _split . length ; i ++ ) { fn _before = fn _before [ before _obj _split [ i ] ] ; } }
if ( typeof fn _before == "function" ) { fn _before ( e ) ; }
var inline _options = $ ( this ) . data ( "options" ) || { } ; if ( $this . is ( "[data-confirm]" ) ) { var default _options = { message : $this . data ( "confirm" ) , confirm : typeof submit _function == "function" ? submit _function ( args ) : "" , cancel : typeof cancel _function == "function" ? cancel _function ( args ) : "" , ajax : ajax } ; if ( $this . attr ( "href" ) && default _options . confirm == "" ) { default _options . confirm = function ( ) { return window . location . replace ( $this . attr ( "href" ) ) ; } }
PF . fn . modal . confirm ( $ . extend ( default _options , inline _options ) ) ; } else { var default _options = { template : $target . html ( ) , button _submit : $ ( this ) . is ( "[data-modal=edit]" ) ? PF . fn . _s ( "Save changes" ) : PF . fn . _s ( "Submit" ) , confirm : function ( ) { var form _modal _has _changed = PF . fn . form _modal _has _changed ( ) ; var $form = $ ( "form" , PF . obj . modal . selectors . root ) ; if ( typeof $form . attr ( "action" ) !== "undefined" ) { $form . data ( "prevented" , ! form _modal _has _changed ) ; PF . fn . modal . close ( ) ; return ; }
$ ( ":input[name]" , $form ) . each ( function ( ) { if ( ! $ ( this ) . is ( ":visible" ) ) { var input _attr = $ ( this ) . attr ( "required" ) ; if ( typeof input _attr !== typeof undefined && input _attr !== false ) { $ ( this ) . prop ( "required" , false ) . attr ( "data-required" , "required" ) ; } } else { if ( $ ( this ) . attr ( "data-required" ) == "required" ) { $ ( this ) . prop ( "required" , true ) ; } } } ) ; if ( ! $form [ 0 ] . checkValidity ( ) ) { return false ; }
if ( ! form _modal _has _changed && ! inline _options . forced ) { PF . fn . modal . close ( ) ; return ; }
if ( typeof submit _function == "function" ) submit _fn = submit _function ( ) ; if ( typeof submit _fn !== "undefined" && submit _fn == false ) { return false ; }
$ ( ":input" , PF . obj . modal . selectors . root ) . each ( function ( ) { $ ( this ) . val ( $ . trim ( $ ( this ) . val ( ) ) ) ; } ) ; if ( $this . is ( "[data-modal=edit]" ) ) { $target . html ( $ ( PF . obj . modal . selectors . body , $ ( PF . obj . modal . selectors . root ) . bindFormData ( ) ) . html ( ) . replace ( /rel=[\'"]tooltip[\'"]/g , 'rel="template-tooltip"' ) ) ; }
if ( typeof ajax . url !== "undefined" ) { return true ; } else { PF . fn . modal . close ( function ( ) { if ( typeof submit _done _msg !== "undefined" ) { PF . fn . growl . expirable ( submit _done _msg !== "" ? submit _done _msg : PF . fn . _s ( "Changes saved successfully." ) ) ; } } ) ; } } , cancel : function ( ) { if ( typeof cancel _fn == "function" ) cancel _fn = cancel _fn ( ) ; if ( typeof cancel _fn !== "undefined" && cancel _fn == false ) { return false ; }
if ( PF . fn . form _modal _has _changed ( ) ) { if ( $ ( PF . obj . modal . selectors . changes _confirm ) . exists ( ) ) return ; $ ( PF . obj . modal . selectors . box , PF . obj . modal . selectors . root ) . css ( { transition : "none" } ) . hide ( ) ; $ ( PF . obj . modal . selectors . root ) . append ( '<div id="' + PF . obj . modal . selectors . changes _confirm . replace ( "#" , "" ) + '"><div class="content-width"><h2>' + PF . fn . _s ( "All the changes that you have made will be lost if you continue." ) + '</h2><div class="' + PF . obj . modal . selectors . btn _container . replace ( "." , "" ) + ' margin-bottom-0"><button class="btn btn-input default" data-action="cancel">' + PF . fn . _s ( "Go back to form" ) + '</button> <span class="btn-alt">' + PF . fn . _s ( "or" ) + ' <a data-action="submit">' + PF . fn . _s ( "continue anyway" ) + '</a></span></div></div>' ) ; $ ( PF . obj . modal . selectors . changes _confirm ) . css ( "margin-top" , - $ ( PF . obj . modal . selectors . changes _confirm ) . outerHeight ( true ) / 2 ) . hide ( ) . fadeIn ( "fast" ) ; } else { PF . fn . modal . close ( ) ; if ( window . location . hash == "#edit" ) window . location . hash = "" ; } } , load : function ( ) { if ( typeof load _function == "function" ) load _function ( ) ; } , callback : function ( ) { } , ajax : ajax } ; PF . fn . modal . call ( $ . extend ( default _options , inline _options ) ) ; } } ) ; if ( ! PF . fn . is _user _logged ( ) ) { $ ( "[data-login-needed]:input, [data-user-logged=must]:input" ) . each ( function ( ) { $ ( this ) . attr ( "readonly" , true ) ; } ) ; }
$ ( document ) . on ( "click focus" , "[data-login-needed], [data-user-logged=must]" , function ( e ) { if ( ! PF . fn . is _user _logged ( ) ) { e . preventDefault ( ) ; e . stopPropagation ( ) ; if ( $ ( this ) . is ( ":input" ) ) $ ( this ) . attr ( "readonly" , true ) . blur ( ) ; PF . fn . modal . call ( { type : "login" } ) ; } } ) ; $ ( document ) . on ( "keydown" , PF . obj . modal . selectors . root + " input" , function ( e ) { var $this = $ ( e . target ) , key = e . charCode || e . keyCode ; if ( key !== 13 ) { PF . fn . growl . close ( ) ; return ; }
if ( key == 13 && $ ( "[data-action=submit]" , PF . obj . modal . selectors . root ) . exists ( ) && ! $this . is ( ".prevent-submit" ) ) { $ ( "[data-action=submit]" , PF . obj . modal . selectors . root ) . click ( ) ; } } ) ; if ( window . location . hash && window . location . hash == "#edit" ) { $ ( "[data-modal=edit]" ) . first ( ) . click ( ) ; }
$ ( document ) . on ( "click" , "[data-action=top-bar-menu-full]" , function ( ) { var hasClass = $ ( '[data-action=top-bar-menu-full]' , "#top-bar" ) . hasClass ( "current" ) ; PF . fn . topMenu [ hasClass ? "hide" : "show" ] ( ) ; } ) ; $ ( document ) . on ( "click" , "[data-action=top-bar-search]" , function ( ) { $ ( "[data-action=top-bar-search-input]" , ".top-bar" ) . removeClass ( "hidden" ) . show ( ) ; $ ( "[data-action=top-bar-search-input]:visible input" ) . first ( ) . focus ( ) ; if ( is _ios ( ) && ! $ ( this ) . closest ( PF . fn . topMenu . vars . menu ) . exists ( ) ) { $ ( '.top-bar' ) . css ( 'position' , 'absolute' ) ; }
2016-11-06 02:19:47 +00:00
$ ( "[data-action=top-bar-search]" , ".top-bar" ) . hide ( ) ; } ) ; $ ( document ) . on ( "click" , ".input-search .icon-search" , function ( e ) { $ ( "input" , e . currentTarget . offsetParent ) . focus ( ) ; } ) ; $ ( document ) . on ( "click" , ".input-search .icon-close, .input-search [data-action=clear-search]" , function ( e ) { var $input = $ ( "input" , e . currentTarget . offsetParent ) ; if ( $input . val ( ) == "" ) { if ( $ ( this ) . closest ( "[data-action=top-bar-search-input]" ) . exists ( ) ) { $ ( "[data-action=top-bar-search-input]" , ".top-bar" ) . hide ( ) ; $ ( "[data-action=top-bar-search]" , ".top-bar" ) . removeClass ( "opened" ) . show ( ) ; if ( is _ios ( ) && $ ( this ) . closest ( "#top-bar" ) . css ( "position" ) !== "fixed" ) { $ ( ".top-bar" ) . css ( "position" , "fixed" ) ; } } } else { if ( ! $ ( this ) . closest ( "[data-action=top-bar-search-input]" ) . exists ( ) ) { $ ( this ) . hide ( ) ; }
2016-08-18 20:39:31 +00:00
$input . val ( "" ) . change ( ) ; } } ) ; $ ( document ) . on ( "keyup change" , "input.search" , function ( e ) { var $input = $ ( this ) , $div = $ ( this ) . closest ( ".input-search" ) ; if ( ! $ ( this ) . closest ( "[data-action=top-bar-search-input]" ) . exists ( ) ) { var todo = $input . val ( ) == "" ? "hide" : "show" ; $ ( ".icon-close, [data-action=clear-search]" , $div ) [ todo ] ( ) ; } } ) ; $ ( document ) . on ( "click mouseenter" , ".pop-btn" , function ( e ) { if ( PF . fn . isDevice ( [ "phone" , "phablet" ] ) && ( e . type == "mouseenter" || $ ( this ) . hasClass ( "pop-btn-desktop" ) ) ) { return ; }
var $this _click = $ ( e . target ) , $pop _btn , $pop _box , devices = $ . makeArray ( [ "phone" , "phablet" ] ) ; var $this = $ ( this ) ; if ( e . type == "mouseenter" && ! $ ( this ) . hasClass ( "pop-btn-auto" ) ) return ; if ( $ ( this ) . hasClass ( "disabled" ) || ( ( $this _click . closest ( ".current" ) . exists ( ) && ! PF . fn . isDevice ( "phone" ) ) && ! $this _click . closest ( ".pop-btn-show" ) . exists ( ) ) ) { return ; }
PF . fn . growl . close ( ) ; e . stopPropagation ( ) ; $pop _btn = $ ( this ) ; $pop _box = $ ( ".pop-box" , $pop _btn ) ; $pop _btn . addClass ( "opened" ) ; $ ( ".pop-box-inner" , $pop _box ) . css ( "max-height" , "" ) ; if ( PF . fn . isDevice ( devices ) ) { var text = $ ( '.btn-text,.text,.pop-btn-text' , $pop _btn ) . first ( ) . text ( ) ; if ( typeof text == "undefined" || text == "" ) { text = PF . fn . _s ( "Select" ) ; }
if ( ! $ ( ".pop-box-header" , $pop _box ) . exists ( ) ) { $pop _box . prepend ( $ ( '<div/>' , { "class" : 'pop-box-header' , "html" : text + '<span class="btn-icon icon-close"></span></span>' } ) ) ; } } else { $ ( '.pop-box-header' , $pop _box ) . remove ( ) ; $pop _box . css ( { bottom : '' } ) ; }
if ( $pop _box . hasClass ( "anchor-center" ) ) { if ( ! PF . fn . isDevice ( devices ) ) { $pop _box . css ( "margin-left" , - ( $pop _box . width ( ) / 2 ) ) ; } else { $pop _box . css ( "margin-left" , "" ) ; } }
if ( $this _click . is ( "[data-change]" ) ) { $ ( "li" , $pop _box ) . removeClass ( "current" ) ; $this _click . closest ( "li" ) . addClass ( "current" ) ; $ ( "[data-text-change]" , $pop _btn ) . text ( $ ( "li.current a" , $pop _box ) . text ( ) ) ; e . preventDefault ( ) ; }
if ( ! $pop _box . exists ( ) ) return ; var $this = e . istriggered ? $ ( e . target ) : $ ( this ) ; if ( $pop _box . is ( ":visible" ) && $ ( e . target ) . closest ( ".pop-box-inner" ) . exists ( ) && $this . hasClass ( "pop-keep-click" ) ) { return ; }
$ ( ".pop-box:visible" ) . not ( $pop _box ) . hide ( ) . closest ( ".pop-btn" ) . removeClass ( "opened" ) ; var callback = function ( $pop _box ) { if ( ! $pop _box . is ( ":visible" ) ) { $pop _box . closest ( ".pop-btn" ) . removeClass ( "opened" ) ; } else { if ( ! PF . fn . isDevice ( devices ) ) { $ ( ".antiscroll-wrap:not(.jsly):visible" , $pop _box ) . addClass ( "jsly" ) . antiscroll ( ) ; } else { $ ( ".antiscroll-inner" , $pop _box ) . height ( "100%" ) ; } } } ; if ( PF . fn . isDevice ( devices ) ) { if ( $ ( this ) . is ( "[data-action=top-bar-notifications]" ) ) { $pop _box . css ( { height : $ ( window ) . height ( ) } ) ; }
var pop _box _h = $pop _box . height ( ) + 'px' ; var menu _top = ( parseInt ( $ ( ".top-bar" ) . outerHeight ( ) ) + parseInt ( $ ( ".top-bar" ) . css ( "top" ) ) + parseInt ( $ ( ".top-bar" ) . css ( "margin-top" ) ) + parseInt ( $ ( ".top-bar" ) . css ( "margin-bottom" ) ) ) + "px" ; if ( $pop _box . is ( ":visible" ) ) { $ ( '#pop-box-mask' ) . css ( { opacity : 0 } ) ; $pop _box . css ( { transform : "none" } ) ; if ( $this . closest ( PF . fn . topMenu . vars . menu ) . exists ( ) ) { $ ( ".top-bar" ) . css ( { transform : "none" } ) ; $ ( PF . fn . topMenu . vars . menu ) . css ( { height : $ ( window ) . height ( ) + parseInt ( menu _top ) , } ) ; }
setTimeout ( function ( ) { $pop _box . hide ( ) . attr ( "style" , "" ) ; $ ( '#pop-box-mask' ) . remove ( ) ; callback ( $pop _box ) ; if ( $this . closest ( PF . fn . topMenu . vars . menu ) . exists ( ) ) { $ ( PF . fn . topMenu . vars . menu ) . css ( { height : "" , } ) ; $ ( PF . fn . topMenu . vars . menu ) . animate ( { scrollTop : PF . fn . topMenu . vars . scrollTop } , PF . obj . config . animation . normal / 2 ) ; } } , PF . obj . config . animation . normal ) ; if ( ! $ ( "body" ) . data ( "hasOverflowHidden" ) ) { $ ( "body" ) . removeClass ( "overflow-hidden" ) ; } } else { $ ( '#pop-box-mask' ) . remove ( ) ; $pop _box . parent ( ) . prepend ( $ ( '<div/>' , { "id" : 'pop-box-mask' , "class" : 'fullscreen soft-black' } ) . css ( { zIndex : 400 , display : "block" } ) ) ; PF . fn . topMenu . vars . scrollTop = $ ( PF . fn . topMenu . vars . menu ) . scrollTop ( ) ; setTimeout ( function ( ) { $ ( "#pop-box-mask" ) . css ( { opacity : 1 } ) ; setTimeout ( function ( ) { $pop _box . show ( ) . css ( { bottom : '-' + pop _box _h , maxHeight : $ ( window ) . height ( ) , zIndex : 1000 , transform : "translate(0,-" + pop _box _h + ")" } ) ; setTimeout ( function ( ) { callback ( $pop _box ) ; } , PF . obj . config . animation . normal ) ; if ( $ ( "body" ) . hasClass ( "overflow-hidden" ) ) { $ ( "body" ) . data ( "hasOverflowHidden" , 1 ) ; } else { $ ( "body" ) . addClass ( "overflow-hidden" ) ; }
if ( $this . closest ( PF . fn . topMenu . vars . menu ) . exists ( ) ) { $ ( ".top-bar" ) . css ( { transform : "translate(0, -" + menu _top + ")" } ) ; $ ( PF . fn . topMenu . vars . menu ) . css ( { height : $ ( window ) . height ( ) + parseInt ( menu _top ) , } ) ; }
$ ( ".pop-box-inner" , $pop _box ) . css ( "height" , $pop _box . height ( ) - $ ( '.pop-box-header' , $pop _box ) . outerHeight ( true ) ) ; } , 1 ) ; } , 1 ) ; } } else { $pop _box [ "fade" + ( $pop _box . is ( ":visible" ) ? "Out" : "In" ) ] ( 50 , function ( ) { callback ( $pop _box ) ; } ) ; } } ) . on ( "mouseleave" , ".pop-btn" , function ( ) { if ( ! PF . fn . isDevice ( [ "laptop" , "desktop" ] ) ) { return ; }
var $pop _btn = $ ( this ) , $pop _box = $ ( ".pop-box" , $pop _btn ) ; if ( ! $pop _btn . hasClass ( "pop-btn-auto" ) || ( PF . fn . isDevice ( [ "phone" , "phablet" ] ) && $pop _btn . hasClass ( "pop-btn-auto" ) ) ) { return ; }
if ( ! PF . fn . isDevice ( [ 'phone' , 'phablet' , 'tablet' ] ) && $ ( this ) . hasClass ( "pop-btn-delayed" ) ) { $ ( this ) . removeClass ( "pop-btn-auto" ) ; }
$pop _box . hide ( ) . closest ( ".pop-btn" ) . removeClass ( "opened" ) ; } ) ; $ ( ".pop-btn-delayed" ) . delayedAction ( { delayedAction : function ( $element ) { if ( PF . fn . isDevice ( [ 'phone' , 'phablet' , 'tablet' ] ) ) return ; var $el = $ ( ".pop-box-inner" , $element ) ; if ( $el . is ( ":hidden" ) ) { $element . addClass ( "pop-btn-auto" ) . click ( ) ; } } , hoverTime : 2000 } ) ; if ( window . location . hash ) { }
if ( $ ( ".content-tabs" ) . exists ( ) ) { var $tab = $ ( "a" , ".content-tabs .current" ) ; History . replaceState ( { href : $tab . attr ( "href" ) , "data-tab" : $tab . data ( "tab" ) , pushed : "tabs" , statenum : 0 } , null , null ) ; }
var State = History . getState ( ) ; if ( typeof State . data == "undefined" ) { History . replaceState ( { scrollTop : 0 } , document . title , window . location . href ) ; }
History . Adapter . bind ( window , "popstate" , function ( ) { var State = History . getState ( ) ; if ( State . data && typeof State . data . scrollTop !== "undefined" ) { if ( $ ( window ) . scrollTop ( ) !== State . data . scrollTop ) { $ ( window ) . scrollTop ( State . data . scrollTop ) ; } }
return ; } ) ; $ ( "a" , ".content-tabs" ) . click ( function ( e ) { if ( $ ( this ) . data ( "link" ) == true ) { $ ( this ) . data ( "tab" , false ) ; }
if ( $ ( this ) . closest ( ".current,.disabled" ) . exists ( ) ) { e . preventDefault ( ) ; return ; }
if ( typeof $ ( this ) . data ( "tab" ) == "undefined" ) return ; var dataTab = { } ; $ . each ( this . attributes , function ( ) { dataTab [ this . name ] = this . value ; } ) ; dataTab . pushed = "tabs" ; if ( $ ( "#" + dataTab [ "data-tab" ] ) . data ( "load" ) != "classic" ) { if ( window . location . hash ) { var url = window . location . href ; url = url . replace ( window . location . hash , "" ) ; }
History . pushState ( dataTab , document . title , ( typeof url !== "undefined" ) ? url : $ ( this ) . attr ( "href" ) ) ; e . preventDefault ( ) ; }
var $tab _menu = $ ( "[data-action=tab-menu]" , $ ( this ) . closest ( ".header" ) ) ; $tab _menu . find ( "[data-content=current-tab-label]" ) . text ( $ ( this ) . text ( ) ) ; if ( $tab _menu . is ( ":visible" ) ) { $tab _menu . click ( ) ; } } ) ; $ ( document ) . on ( "click" , "[data-action=tab-menu]" , function ( ) { var $tabs = $ ( this ) . closest ( ".header" ) . find ( ".content-tabs" ) , visible = $tabs . is ( ":visible" ) , $this = $ ( this ) ; if ( ! visible ) { $tabs . data ( "classes" , $tabs . attr ( "class" ) ) ; $tabs . removeClass ( function ( index , css ) { return ( css . match ( /\b\w+-hide/g ) || [ ] ) . join ( ' ' ) ; } ) ; $tabs . hide ( ) ; }
if ( ! visible ) { $this . removeClass ( "current" ) ; }
$tabs [ visible ? "hide" : "show" ] ( ) ; if ( visible ) { $tabs . css ( "display" , "" ) . addClass ( $tabs . data ( "classes" ) ) ; $this . addClass ( "current" ) ; } } ) ; $ ( window ) . bind ( "statechange" , function ( e ) { PF . fn . growl . close ( ) ; var dataTab ; dataTab = History . getState ( ) . data ; if ( dataTab && dataTab . pushed == "tabs" ) { PF . fn . show _tab ( dataTab [ "data-tab" ] ) ; } } ) ; $ ( document ) . on ( "click" , ".list-item a" , function ( e ) { if ( $ ( this ) . attr ( "src" ) == "" ) return ; History . replaceState ( { scrollTop : $ ( window ) . scrollTop ( ) } , document . title , window . location . href ) ; } ) ; $ ( document ) . on ( "click" , "[data-action=load-more]" , function ( e ) { $ ( this ) . closest ( '.content-listing-more' ) . hide ( ) ; if ( ! PF . fn . is _listing ( ) || $ ( this ) . closest ( PF . obj . listing . selectors . content _listing ) . is ( ":hidden" ) || $ ( this ) . closest ( "#content-listing-template" ) . exists ( ) || PF . obj . listing . calling ) return ; PF . fn . listing . queryString . stock _new ( ) ; PF . obj . listing . query _string . page = $ ( PF . obj . listing . selectors . content _listing _visible ) . data ( "page" ) ; PF . obj . listing . query _string . page ++ ; var offset = $ ( PF . obj . listing . selectors . content _listing _visible ) . data ( "offset" ) ; if ( typeof offset !== "undefined" ) { PF . obj . listing . query _string . offset = offset ; if ( typeof PF . obj . listing . hidden _params == "undefined" ) { PF . obj . listing . hidden _params = { } ; }
PF . obj . listing . hidden _params . offset = offset ; } else { if ( typeof PF . obj . listing . query _string . offset !== "undefined" ) { delete PF . obj . listing . query _string . offset ; }
if ( PF . obj . listing . hidden _params && typeof PF . obj . listing . hidden _params . offset !== "undefined" ) { delete PF . obj . listing . hidden _params . offset ; } }
PF . fn . listing . ajax ( ) ; e . preventDefault ( ) ; } ) ; if ( $ ( PF . obj . listing . selectors . list _item ) . length > 0 ) { PF . fn . listing . show ( ) ; $ ( window ) . scroll ( function ( ) { var $loadMore = $ ( PF . obj . listing . selectors . content _listing _pagination , PF . obj . listing . selectors . content _listing _visible ) . find ( "[data-action=load-more]" ) ; if ( $loadMore . length > 0 && ( ( $ ( window ) . scrollTop ( ) + $ ( window ) . innerHeight ( ) ) > ( $ ( document ) . height ( ) - 300 ) ) && PF . obj . listing . calling == false ) { $loadMore . click ( ) ; } } ) ; }
$ ( document ) . on ( "click" , PF . obj . modal . selectors . root + " [data-switch]" , function ( ) { var $this _modal = $ ( this ) . closest ( PF . obj . modal . selectors . root ) ; $ ( "[data-view=switchable]" , $this _modal ) . hide ( ) ; $ ( "#" + $ ( this ) . attr ( "data-switch" ) , $this _modal ) . show ( ) ; } ) ; $ ( document ) . on ( "click" , "[data-toggle]" , function ( ) { var $target = $ ( "[data-content=" + $ ( this ) . data ( "toggle" ) + "]" ) , show = ! $target . is ( ":visible" ) ; $ ( this ) . html ( $ ( this ) . data ( 'html-' + ( show ? 'on' : 'off' ) ) ) ; $target . toggle ( ) ; } ) ; $ ( document ) . on ( "click" , "[data-action=cookie-law-close]" , function ( ) { $ ( "#cookie-law-banner" ) . animate ( { bottom : "-100%" } , 300 , function ( ) { var cookieName = ( typeof $ ( this ) . data ( "cookie" ) !== typeof undefined ) ? $ ( this ) . data ( "cookie" ) : "PF_COOKIE_LAW_DISPLAY" ; Cookies . set ( cookieName , 0 , { expires : 365 } ) ; $ ( this ) . remove ( ) ; } ) ; } ) ; Clipboard = new Clipboard ( "[data-action=copy]" , { text : function ( trigger ) { var $target = $ ( trigger . getAttribute ( "data-action-target" ) ) ; var text = $target . is ( ":input" ) ? $target . val ( ) : $target . text ( ) ; return text . trim ( ) ; } } ) ; Clipboard . on ( 'success' , function ( e ) { var $target = $ ( e . trigger . getAttribute ( "data-action-target" ) ) ; $target . highlight ( ) ; e . clearSelection ( ) ; } ) ; } ) ; var PF = { fn : { } , str : { } , obj : { } } ; PF . obj . config = { base _url : "" , json _api : "/json/" , listing : { items _per _page : 24 } , animation : { easingFn : "ease" , normal : 400 , fast : 250 } } ; PF . obj . l10n = { } ; PF . fn . _s = function ( string , s ) { var string ; if ( typeof string == "undefined" ) { return string ; }
if ( typeof PF . obj . l10n !== "undefined" && typeof PF . obj . l10n [ string ] !== "undefined" ) { string = PF . obj . l10n [ string ] [ 0 ] ; if ( typeof string == "undefined" ) { string = string ; } } else { string = string ; }
string = string . toString ( ) ; if ( typeof s !== "undefined" ) { string = sprintf ( string , s ) ; }
return string ; } ; PF . fn . _n = function ( singular , plural , n ) { var string ; if ( typeof PF . obj . l10n !== "undefined" && typeof PF . obj . l10n [ singular ] !== "undefined" ) { string = PF . obj . l10n [ singular ] [ n == 1 ? 0 : 1 ] ; } else { string = n == 1 ? singular : plural ; }
string = typeof string == "undefined" ? singular : string . toString ( ) ; if ( typeof n !== "undefined" ) { string = sprintf ( string , n ) ; }
return string ; } ; PF . fn . extend _lang = function ( strings ) { $ . each ( PF . obj . lang _strings , function ( i , v ) { if ( typeof strings [ i ] !== "undefined" ) { $ . extend ( PF . obj . lang _strings [ i ] , strings [ i ] ) ; } } ) ; } ; PF . fn . get _url _vars = function ( ) { var match , pl = /\+/g , search = /([^&=]+)=?([^&]*)/g , decode = function ( s ) { return decodeURIComponent ( escape ( s . replace ( pl , " " ) ) ) ; } , query = window . location . search . substring ( 1 ) , urlParams = { } ; while ( match = search . exec ( query ) ) { urlParams [ decode ( match [ 1 ] ) ] = decode ( match [ 2 ] ) ; }
return urlParams ; } ; PF . fn . get _url _var = function ( name ) { return PF . fn . get _url _vars ( ) [ name ] ; } ; PF . fn . is _user _logged = function ( ) { return $ ( "#top-bar-user" ) . is ( ":visible" ) ; } ; PF . fn . generate _random _string = function ( len ) { if ( typeof len == "undefined" ) len = 5 ; var text = "" ; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ; for ( var i = 0 ; i < len ; i ++ ) { text += possible . charAt ( Math . floor ( Math . random ( ) * possible . length ) ) ; }
return text ; } ; PF . fn . getDateTime = function ( ) { var now = new Date ( ) ; var year = now . getFullYear ( ) ; var month = now . getMonth ( ) + 1 ; var day = now . getDate ( ) ; var hour = now . getHours ( ) ; var minute = now . getMinutes ( ) ; var second = now . getSeconds ( ) ; if ( month . toString ( ) . length == 1 ) { var month = '0' + month ; }
if ( day . toString ( ) . length == 1 ) { var day = '0' + day ; }
if ( hour . toString ( ) . length == 1 ) { var hour = '0' + hour ; }
if ( minute . toString ( ) . length == 1 ) { var minute = '0' + minute ; }
if ( second . toString ( ) . length == 1 ) { var second = '0' + second ; }
var dateTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second ; return dateTime ; } ; PF . fn . htmlEncode = function ( value ) { return $ ( '<div/>' ) . text ( $ . trim ( value ) ) . html ( ) ; } ; PF . fn . htmlDecode = function ( value ) { return $ ( '<div/>' ) . html ( $ . trim ( value ) ) . text ( ) ; } ; PF . fn . nl2br = function ( str ) { var breakTag = '<br>' ; return ( str + '' ) . replace ( /([^>\r\n]?)(\r\n|\n\r|\r|\n)/g , '$1' + breakTag + '$2' ) ; } ; PF . fn . versionCompare = function ( left , right ) { if ( typeof left + typeof right != 'stringstring' )
return false ; var a = left . split ( '.' ) , b = right . split ( '.' ) , i = 0 , len = Math . max ( a . length , b . length ) ; for ( ; i < len ; i ++ ) { if ( ( a [ i ] && ! b [ i ] && parseInt ( a [ i ] ) > 0 ) || ( parseInt ( a [ i ] ) > parseInt ( b [ i ] ) ) ) { return 1 ; } else if ( ( b [ i ] && ! a [ i ] && parseInt ( b [ i ] ) > 0 ) || ( parseInt ( a [ i ] ) < parseInt ( b [ i ] ) ) ) { return - 1 ; } }
return 0 ; }
PF . fn . baseName = function ( str ) { var base = new String ( str ) . substring ( str . lastIndexOf ( '/' ) + 1 ) ; if ( base . lastIndexOf ( "." ) != - 1 ) { base = base . substring ( 0 , base . lastIndexOf ( "." ) ) ; }
return base ; }
PF . fn . guid = function ( ) { function s4 ( ) { return Math . floor ( ( 1 + Math . random ( ) ) * 0x10000 ) . toString ( 16 ) . substring ( 1 ) ; }
return s4 ( ) + s4 ( ) + '-' + s4 ( ) + '-' + s4 ( ) + '-' + s4 ( ) + '-' + s4 ( ) + s4 ( ) + s4 ( ) ; }
PF . fn . md5 = function ( string ) { return SparkMD5 . hash ( string ) ; }
PF . fn . dataURItoBlob = function ( dataURI ) { var byteString ; if ( dataURI . split ( ',' ) [ 0 ] . indexOf ( 'base64' ) >= 0 ) { byteString = atob ( dataURI . split ( ',' ) [ 1 ] ) ; } else { byteString = unescape ( dataURI . split ( ',' ) [ 1 ] ) ; }
var mimeString = dataURI . split ( ',' ) [ 0 ] . split ( ':' ) [ 1 ] . split ( ';' ) [ 0 ] ; var ia = new Uint8Array ( byteString . length ) ; for ( var i = 0 ; i < byteString . length ; i ++ ) { ia [ i ] = byteString . charCodeAt ( i ) ; }
return new Blob ( [ ia ] , { type : mimeString } ) ; }
PF . fn . clean _facebook _hash = function ( ) { if ( window . location . hash == "#_=_" ) { window . location . hash = "" ; } } ; PF . fn . clean _facebook _hash ( ) ; Array . min = function ( array ) { return Math . min . apply ( Math , array ) ; } ; Array . max = function ( array ) { return Math . max . apply ( Math , array ) ; } ; Array . sum = function ( array ) { return array . reduce ( function ( pv , cv ) { return cv + pv } ) ; } ; Object . size = function ( obj ) { var size = 0 , key ; for ( key in obj ) { if ( obj . hasOwnProperty ( key ) ) size ++ ; }
return size ; } ; Object . flatten = function ( obj , prefix ) { if ( typeof prefix == "undefined" ) var prefix = "" ; var result = { } ; $ . each ( obj , function ( key , value ) { if ( ! value ) return ; if ( typeof value == "object" ) { result = $ . extend ( { } , result , Object . flatten ( value , prefix + key + '_' ) ) ; } else { result [ prefix + key ] = value ; } } ) ; return result ; } ; String . prototype . isNumeric = function ( ) { return ! isNaN ( parseFloat ( this ) ) && isFinite ( this ) ; } ; String . prototype . repeat = function ( num ) { return new Array ( num + 1 ) . join ( this ) ; } ; String . prototype . capitalizeFirstLetter = function ( ) { return this . charAt ( 0 ) . toUpperCase ( ) + this . slice ( 1 ) ; }
String . prototype . isEmail = function ( ) { var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ; return regex . test ( this ) ; } ; String . prototype . getRounded = function ( precision , mode ) { var m , f , isHalf , sgn ; precision |= 0 ; m = Math . pow ( 10 , precision ) ; value = this ; value *= m ; sgn = ( value > 0 ) | - ( value < 0 ) ; isHalf = value % 1 === 0.5 * sgn ; f = Math . floor ( value ) ; if ( isHalf ) { switch ( mode ) { case 'PHP_ROUND_HALF_DOWN' : value = f + ( sgn < 0 ) ; break ; case 'PHP_ROUND_HALF_EVEN' : value = f + ( f % 2 * sgn ) ; break ; case 'PHP_ROUND_HALF_ODD' : value = f + ! ( f % 2 ) ; break ; default : value = f + ( sgn > 0 ) ; } }
return ( isHalf ? value : Math . round ( value ) ) / m ; } ; String . prototype . getBytes = function ( ) { var units = [ "KB" , "MB" , "GB" , "TB" , "PB" , "EB" , "ZB" , "YB" ] , suffix = this . toUpperCase ( ) . substr ( - 2 ) ; if ( units . indexOf ( suffix ) == - 1 ) { return this ; }
var pow _factor = units . indexOf ( suffix ) + 1 ; return parseFloat ( this ) * Math . pow ( 1000 , pow _factor ) ; } ; String . prototype . formatBytes = function ( round ) { var bytes = parseInt ( this ) , units = [ "KB" , "MB" , "GB" , "TB" , "PB" , "EB" , "ZB" , "YB" ] ; if ( ! $ . isNumeric ( this ) ) { return false ; }
2016-10-12 16:32:18 +00:00
if ( bytes < 1000 ) return bytes + " B" ; if ( typeof round == "undefined" ) var round = 2 ; for ( var i = 0 ; i < units . length ; i ++ ) { var multiplier = Math . pow ( 1000 , i + 1 ) , threshold = multiplier * 1000 ; if ( bytes < threshold ) { var size = bytes / multiplier ; return this . getRounded . call ( size , round ) + " " + units [ i ] ; } } } ; String . prototype . match _image _urls = function ( ) { return this . match ( /\b(?:(http[s]?|ftp[s]):\/\/)?([^:\/\s]+)(:[0-9]+)?((?:\/\w+)*\/)([\w\-\.]+[^#?\s]+)([^#\s]*)?(#[\w\-]+)?\.(?:jpe?g|gif|png|bmp)\b/gim ) ; } ; String . prototype . match _urls = function ( ) { return this . match ( /\b(?:(http[s]?|ftp[s]):\/\/)?([^:\/\s]+)(:[0-9]+)?((?:\/\w+)*\/)([\w\-\.]+[^#?\s]+)([^#\s]*)?(#[\w\-]+)?\b/gim ) ; } ; if ( ! ( "indexOf" in Array . prototype ) ) { Array . prototype . indexOf = function ( find , i ) { if ( i === undefined ) i = 0 ; if ( i < 0 ) i += this . length ; if ( i < 0 ) i = 0 ; for ( var n = this . length ; i < n ; i ++ ) { if ( i in this && this [ i ] === find ) { return i ; } }
2016-08-18 20:39:31 +00:00
return - 1 ; } ; }
Array . prototype . array _unique = function ( ) { var result = [ ] ; $ . each ( this , function ( i , e ) { if ( $ . inArray ( e , result ) == - 1 ) result . push ( e ) ; } ) ; return result ; } ; PF . fn . deparam = function ( querystring ) { if ( typeof querystring == "undefined" || ! querystring ) return ; var obj = { } , pairs = querystring . replace ( /^[\?|&]*/ , "" ) . replace ( /[&|\?]*$/ , "" ) . split ( "&" ) ; for ( var i = 0 ; i < pairs . length ; i ++ ) { var split = pairs [ i ] . split ( '=' ) ; var key = decodeURIComponent ( split [ 0 ] ) ; var value = decodeURIComponent ( split [ 1 ] ) ; if ( obj . hasOwnProperty ( key ) && ! value ) { continue ; }
obj [ key ] = value ; }
return obj ; } ; String . prototype . removeURLParameter = function ( key ) { var url = "" , deparam = PF . fn . deparam ( this ) ; if ( typeof deparam [ key ] !== "undefined" ) { delete deparam [ key ] ; }
return decodeURIComponent ( $ . param ( deparam ) ) ; } ; String . prototype . truncate _middle = function ( l ) { var l = typeof ( l ) != "undefined" ? l : 40 , chunk _l = ( l / 2 ) , url = this . replace ( /https?:\/\//g , "" ) ; if ( url . length <= l ) { return url ; }
function shortString ( s , l , reverse ) { var stop _chars = [ ' ' , '/' , '&' ] , acceptable _shortness = l * 0.80 , reverse = typeof ( reverse ) != "undefined" ? reverse : false , s = reverse ? s . split ( "" ) . reverse ( ) . join ( "" ) : s , short _s = "" ; for ( var i = 0 ; i < l - 1 ; i ++ ) { short _s += s [ i ] ; if ( i >= acceptable _shortness && stop _chars . indexOf ( s [ i ] ) >= 0 ) { break ; } } ; if ( reverse ) { return short _s . split ( "" ) . reverse ( ) . join ( "" ) ; }
return short _s ; } ; return shortString ( url , chunk _l , false ) + "..." + shortString ( url , chunk _l , true ) ; } ; jQuery . extend ( { compare : function ( a , b ) { var obj _str = '[object Object]' , arr _str = '[object Array]' , a _type = Object . prototype . toString . apply ( a ) , b _type = Object . prototype . toString . apply ( b ) ; if ( a _type !== b _type ) { return false ; } else if ( a _type === obj _str ) { return $ . compareObject ( a , b ) ; } else if ( a _type === arr _str ) { return $ . compareArray ( a , b ) ; }
return ( a === b ) ; } , compareArray : function ( arrayA , arrayB ) { var a , b , i , a _type , b _type ; if ( arrayA === arrayB ) { return true ; }
if ( arrayA . length != arrayB . length ) { return false ; }
a = jQuery . extend ( true , [ ] , arrayA ) ; b = jQuery . extend ( true , [ ] , arrayB ) ; a . sort ( ) ; b . sort ( ) ; for ( i = 0 , l = a . length ; i < l ; i += 1 ) { a _type = Object . prototype . toString . apply ( a [ i ] ) ; b _type = Object . prototype . toString . apply ( b [ i ] ) ; if ( a _type !== b _type ) { return false ; }
if ( $ . compare ( a [ i ] , b [ i ] ) === false ) { return false ; } }
return true ; } , compareObject : function ( objA , objB ) { var i , a _type , b _type ; if ( objA === objB ) { return true ; }
if ( Object . keys ( objA ) . length !== Object . keys ( objB ) . length ) { return false ; }
for ( i in objA ) { if ( objA . hasOwnProperty ( i ) ) { if ( typeof objB [ i ] === 'undefined' ) { return false ; } else { a _type = Object . prototype . toString . apply ( objA [ i ] ) ; b _type = Object . prototype . toString . apply ( objB [ i ] ) ; if ( a _type !== b _type ) { return false ; } } }
if ( $ . compare ( objA [ i ] , objB [ i ] ) === false ) { return false ; } }
return true ; } } ) ; jQuery . fn . exists = function ( ) { return this . length > 0 ; } ; jQuery . fn . replace _svg = function ( ) { if ( ! this . attr ( "src" ) ) return ; $ ( this ) . each ( function ( ) { $ ( this ) . attr ( "src" , $ ( this ) . attr ( "src" ) . replace ( ".svg" , ".png" ) ) ; } ) ; } ; jQuery . fn . is _fluid = function ( ) { return true ; return ( this . hasClass ( "fluid" ) || this . css ( "width" ) == "100%" ) ; } ; jQuery . fn . bindFormData = function ( ) { $ ( ":input" , this ) . each ( function ( ) { var safeVal = PF . fn . htmlEncode ( $ ( this ) . val ( ) ) ; if ( $ ( this ) . is ( "input" ) ) { this . setAttribute ( "value" , this . value ) ; if ( this . checked ) { this . setAttribute ( "checked" , "checked" ) ; } else { this . removeAttribute ( "checked" ) ; } }
if ( $ ( this ) . is ( "textarea" ) ) { $ ( this ) . html ( safeVal ) ; }
if ( $ ( this ) . is ( "select" ) ) { var index = this . selectedIndex , i = 0 ; $ ( this ) . children ( "option" ) . each ( function ( ) { if ( i ++ != index ) { this . removeAttribute ( "selected" ) ; } else { this . setAttribute ( "selected" , "selected" ) ; } } ) ; } } ) ; return this ; } ; jQuery . fn . formValues = function ( data ) { var els = $ ( ":input" , this ) ; if ( typeof data != "object" ) { data = { } ; $ . each ( els , function ( ) { if ( this . name && ! this . disabled && ( this . checked || /select|textarea/i . test ( this . nodeName ) || /color|date|datetime|datetime-local|email|month|range|search|tel|time|url|week|text|number|hidden|password/i . test ( this . type ) ) ) { if ( this . name . match ( /^.*\[\]$/ ) && this . checked ) { if ( typeof data [ this . name ] == "undefined" ) { data [ this . name ] = [ ] ; }
data [ this . name ] . push ( $ ( this ) . val ( ) ) ; } else { data [ this . name ] = $ ( this ) . val ( ) ; } } } ) ; return data ; } else { $ . each ( els , function ( ) { if ( this . name . match ( /^.*\[\]$/ ) && typeof data [ this . name ] == "object" ) { $ ( this ) . prop ( "checked" , data [ this . name ] . indexOf ( $ ( this ) . val ( ) ) !== - 1 ) ; } else { if ( this . name && data [ this . name ] ) { if ( /checkbox|radio/i . test ( this . type ) ) { $ ( this ) . prop ( "checked" , ( data [ this . name ] == $ ( this ) . val ( ) ) ) ; } else { $ ( this ) . val ( data [ this . name ] ) ; } } else if ( /checkbox|radio/i . test ( this . type ) ) { $ ( this ) . removeProp ( "checked" ) ; } } } ) ; return $ ( this ) ; } } ; jQuery . fn . storeformData = function ( dataname ) { if ( typeof dataname == "undefined" && typeof $ ( this ) . attr ( "id" ) !== "undefined" ) { dataname = $ ( this ) . attr ( "id" ) ; }
if ( typeof dataname !== "undefined" ) $ ( this ) . data ( dataname , $ ( this ) . formValues ( ) ) ; return this ; } ; jQuery . fn . is _sameformData = function ( dataname ) { var $this = $ ( this ) ; if ( typeof dataname == "undefined" ) dataname = $this . attr ( "id" ) ; return jQuery . compare ( $this . formValues ( ) , $this . data ( dataname ) ) ; } ; jQuery . Event . prototype . keydown _numeric = function ( ) { var e = this ; if ( e . shiftKey ) { e . preventDefault ( ) ; return false ; }
var key = e . charCode || e . keyCode , target = e . target , value = ( $ ( target ) . val ( ) == "" ) ? 0 : parseInt ( $ ( target ) . val ( ) ) ; if ( key == 13 ) { return true ; }
if ( key == 46 || key == 8 || key == 9 || key == 27 || ( key == 65 && e . ctrlKey === true ) || ( key >= 35 && key <= 40 ) ) { return true ; } else { if ( ( key < 48 || key > 57 ) && ( key < 96 || key > 105 ) ) { e . preventDefault ( ) ; } } } ; PF . fn . is _canvas _supported = function ( ) { var elem = document . createElement ( "canvas" ) ; return ! ! ( elem . getContext && elem . getContext ( "2d" ) ) ; } ; PF . fn . is _validity _supported = function ( ) { var i = document . createElement ( "input" ) ; return typeof i . validity === "object" ; } ; PF . fn . getScrollBarWidth = function ( ) { var inner = document . createElement ( 'p' ) ; inner . style . width = "100%" ; inner . style . height = "200px" ; var outer = document . createElement ( 'div' ) ; outer . style . position = "absolute" ; outer . style . top = "0px" ; outer . style . left = "0px" ; outer . style . visibility = "hidden" ; outer . style . width = "200px" ; outer . style . height = "150px" ; outer . style . overflow = "hidden" ; outer . appendChild ( inner ) ; document . body . appendChild ( outer ) ; var w1 = inner . offsetWidth ; outer . style . overflow = 'scroll' ; var w2 = inner . offsetWidth ; if ( w1 == w2 ) w2 = outer . clientWidth ; document . body . removeChild ( outer ) ; return ( w1 - w2 ) ; } ; PF . str . ScrollBarWidth = PF . fn . getScrollBarWidth ( ) ; PF . fn . top _notifications _viewed = function ( ) { var $top _bar _notifications = $ ( "[data-action=top-bar-notifications]" ) , $notifications _lists = $ ( ".top-bar-notifications-list" , $top _bar _notifications ) , $notifications _count = $ ( ".top-btn-number" , $top _bar _notifications ) ; if ( $ ( ".persistent" , $top _bar _notifications ) . exists ( ) ) { $notifications _count . text ( $ ( ".persistent" , $top _bar _notifications ) . length ) . addClass ( "on" ) ; } else { $notifications _count . removeClass ( "on" ) ; } } ; PF . fn . bindtipTip = function ( $target , options ) { if ( typeof $target == "undefined" ) $target = $ ( "body" ) ; if ( $target instanceof jQuery == false ) $target = $ ( $target ) ; var bindtipTipoptions = { delay : 0 , content : false , fadeIn : 0 } ; if ( typeof options !== "undefined" ) { if ( typeof options . delay !== "undefined" ) bindtipTipoptions . delay = options . delay ; if ( typeof options . content !== "undefined" ) bindtipTipoptions . content = options . content ; if ( typeof options . content !== "undefined" ) bindtipTipoptions . fadeIn = options . fadeIn ; }
if ( $target . attr ( "rel" ) !== "tooltip" ) $target = $ ( "[rel=tooltip]" , $target ) ; $target . each ( function ( ) { if ( ( typeof $ ( this ) . attr ( "href" ) !== "undefined" || typeof $ ( this ) . data ( "href" ) !== "undefined" ) && PF . fn . isDevice ( [ "phone" , "phablet" , "tablet" ] ) ) { return true ; }
var position = typeof $ ( this ) . data ( "tiptip" ) == "undefined" ? "bottom" : $ ( this ) . data ( "tiptip" ) ; if ( PF . fn . isDevice ( [ "phone" , "phablet" ] ) ) { position = "top" ; }
$ ( this ) . tipTip ( { delay : bindtipTipoptions . delay , defaultPosition : position , content : bindtipTipoptions . content , fadeIn : bindtipTipoptions . fadeIn , fadeOut : 0 } ) ; } ) ; } ; PF . fn . form _modal _has _changed = function ( ) { if ( $ ( PF . obj . modal . selectors . root ) . is ( ":hidden" ) ) return ; if ( typeof $ ( "html" ) . data ( "modal-form-values" ) == typeof undefined ) return ; var data _stored = $ ( "html" ) . data ( "modal-form-values" ) ; var data _modal = PF . fn . deparam ( $ ( ":input:visible" , PF . obj . modal . selectors . root ) . serialize ( ) ) ; var has _changed = false ; var keys = $ . extend ( { } , data _stored , data _modal ) ; for ( var k in keys ) { if ( data _stored [ k ] !== data _modal [ k ] ) { has _changed = true ; break ; } }
return has _changed ; } ; PF . fn . is _listing = function ( ) { return $ ( PF . obj . listing . selectors . content _listing ) . exists ( ) ; } ; PF . fn . is _tabs = function ( ) { return $ ( ".content-tabs" ) . exists ( ) ; } ; jQuery . fn . shake = function ( callback ) { this . each ( function ( init ) { var jqNode = $ ( this ) , jqNode _position = jqNode . css ( "position" ) ; if ( ! jqNode _position . match ( "relative|absolute|fixed" ) ) jqNode . css ( { position : "relative" } ) ; var jqNode _left = parseInt ( jqNode . css ( "left" ) ) ; if ( ! jqNode _left . toString ( ) . isNumeric ( ) ) jqNode _left = 0 ; if ( ! jqNode . is ( ":animated" ) ) { for ( var x = 1 ; x <= 2 ; x ++ ) { jqNode . animate ( { left : jqNode _left - 10 } , 0 ) . animate ( { left : jqNode _left } , 30 ) . animate ( { left : jqNode _left + 10 } , 30 ) . animate ( { left : jqNode _left } , 30 ) ; } ; if ( jqNode _position !== "static" ) jqNode . css ( { position : jqNode _position } ) ; } ; } ) ; if ( typeof callback == "function" ) callback ( ) ; return this ; } ; jQuery . fn . highlight = function ( color ) { if ( this . is ( ":animated" ) || ! this . exists ( ) ) return this ; if ( typeof color == "undefined" ) color = "yellow" ; var fadecolor = color ; switch ( color ) { case "yellow" : fadecolor = "#FFFBA2" ; break ; case "red" : fadecolor = "#FF7F7F" ; break ; default : fadecolor = color ; break ; } ; var base _background _color = $ ( this ) . css ( "background-color" ) , base _background = $ ( this ) . css ( "background" ) ; $ ( this ) . css ( { background : "" , backgroundColor : fadecolor } ) . animate ( { backgroundColor : base _background _color } , 800 , function ( ) { $ ( this ) . css ( "background" , "" ) ; } ) ; return this ; } ; jQuery . fn . pf _slideDown = function ( speed , callback ) { var default _speed = "normal" , this _length = $ ( this ) . length , css _prechanges , css _animation , animation _speed ; if ( typeof speed == "function" ) { callback = speed ; speed = default _speed ; }
if ( typeof speed == "undefined" ) { speed = default _speed ; }
$ ( this ) . each ( function ( index ) { var this _css _top = parseInt ( $ ( this ) . css ( "top" ) ) , to _top = this _css _top > 0 ? this _css _top : 0 ; if ( speed == 0 ) { css _prechanges = { display : "block" , opacity : 0 } , css _animation = { opacity : 1 } , animation _speed = jQuery . speed ( "fast" ) . duration ; } else { css _prechanges = { top : - $ ( this ) . outerHeight ( true ) , opacity : 1 , display : "block" } ; css _animation = { top : to _top } ; animation _speed = jQuery . speed ( speed ) . duration ; }
$ ( this ) . data ( "originalTop" , $ ( this ) . css ( "top" ) ) ; $ ( this ) . css ( css _prechanges ) . animate ( css _animation , animation _speed , function ( ) { if ( index == this _length - 1 ) { if ( typeof callback == "function" ) { callback ( ) ; } } } ) ; } ) ; return this ; } ; jQuery . fn . pf _slideUp = function ( speed , callback ) { var default _speed = "normal" , this _length = $ ( this ) . length ; if ( typeof speed == "function" ) { callback = speed ; speed = default _speed ; }
if ( typeof speed == "undefined" ) { speed = default _speed ; }
$ ( this ) . each ( function ( index ) { $ ( this ) . animate ( { top : - $ ( this ) . outerHeight ( true ) } , jQuery . speed ( speed ) . duration , function ( ) { $ ( this ) . css ( { display : "none" , top : $ ( this ) . data ( "originalTop" ) } ) ; if ( index == this _length - 1 ) { if ( typeof callback == "function" ) { callback ( ) ; } } } ) ; } ) ; return this ; } ; jQuery . fn . is _in _viewport = function ( ) { var rect = $ ( this ) [ 0 ] . getBoundingClientRect ( ) ; return ( rect . top >= 0 && rect . left >= 0 && rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) && rect . right <= ( window . innerWidth || document . documentElement . clientWidth ) ) ; } ; PF . fn . scroll = function ( target , callback ) { if ( typeof target == "function" ) { var callback = target , target = "" ; }
var pxtop = parseInt ( $ ( "body" ) . css ( "margin-top" ) ) ; if ( pxtop == 0 && $ ( ".top-bar-placeholder" ) . exists ( ) ) { pxtop = $ ( ".top-bar-placeholder" ) . height ( ) ; }
if ( ! $ ( target ) . exists ( ) ) target = "html" ; $ ( "body,html" ) . animate ( { scrollTop : $ ( target ) . offset ( ) . top - pxtop } , "normal" , function ( ) { if ( typeof callback == "function" ) callback ( ) ; } ) ; } ; PF . fn . close _pops = function ( e ) { $ ( ".pop-box:visible" ) . each ( function ( ) { $ ( this ) . closest ( ".pop-btn" ) . click ( ) ; } ) ; } ; PF . fn . growl = { selectors : { root : "#growl" } , str : { timeout : null , timeoutcall : false } , call : function ( options ) { if ( typeof options == "undefined" ) return ; if ( typeof options == "string" ) { options = { message : options } ; }
if ( typeof options . message == "undefined" ) return ; var growl _options , $growl , growl _class , growl _color ; growl _options = { message : options . message , insertTo : "body" , where : "before" , color : "default" , css : { } , classes : "" , expires : 0 , callback : function ( ) { } } ; for ( key in growl _options ) { if ( typeof options [ key ] !== "undefined" ) { if ( key . match ( "/^(callback)$/" ) ) { if ( typeof options [ key ] == "function" ) { growl _options [ key ] = options [ key ] ; } } else { growl _options [ key ] = options [ key ] ; } } }
if ( ! $ ( growl _options . insertTo ) . exists ( ) ) { growl _options . insertTo = "body" ; }
if ( $ ( PF . fn . growl . selectors . root ) . exists ( ) ) { if ( $ ( PF . fn . growl . selectors . root ) . text ( ) == growl _options . message ) { $ ( PF . fn . growl . selectors . root ) . shake ( ) ; return ; }
$ ( PF . fn . growl . selectors . root ) . remove ( ) ; }
$growl = $ ( '<div id="' + PF . fn . growl . selectors . root . replace ( "#" , "" ) + '" class="growl">' + growl _options . message + '<span class="icon icon-close" data-action="close"></span></div>' ) . css ( growl _options . css ) . addClass ( growl _options . classes ) ; growl _class = growl _options . insertTo !== "body" ? "static" : "" ; switch ( growl _options . color ) { case "dark" : growl _color = "dark" ; break ; default : growl _color = "" ; break ; }
$growl . addClass ( growl _class + " " + growl _color ) ; if ( growl _options . where == "before" ) { $ ( growl _options . insertTo ) . prepend ( $growl . hide ( ) ) ; } else { $ ( growl _options . insertTo ) . append ( $growl . hide ( ) ) ; }
if ( $ ( ".fullscreen" ) . is ( ":visible" ) ) { $growl . css ( { "z-index" : parseInt ( $ ( ".fullscreen" ) . css ( "z-index" ) ) + 1 } ) ; }
if ( $ ( PF . obj . modal . selectors . root ) . is ( ":visible" ) ) { var $modal _box = $ ( PF . obj . modal . selectors . box , PF . obj . modal . selectors . root ) ; $growl . show ( ) ; $growl . css ( "top" , ( $ ( "#top-bar" ) . outerHeight ( true ) - $growl . outerHeight ( true ) ) / 2 ) ; PF . fn . growl . fixPosition ( ) ; $growl . hide ( ) ; }
$growl . pf _slideDown ( growl _class == "static" ? 0 : 200 , function ( ) { if ( typeof growl _options . callback == "function" ) { growl _options . callback ( ) ; } } ) ; $ ( document ) . on ( "click" , ".growl" , function ( e ) { if ( PF . fn . isDevice ( [ "phone" , "phablet" ] ) || $ ( e . target ) . is ( "[data-action=close]" ) ) { PF . fn . growl . close ( true ) ; } } ) ; if ( growl _options . expires > 0 ) { if ( typeof this . str . timeout == "number" ) { clearTimeout ( this . str . timeout ) ; }
this . str . timeout = setTimeout ( function ( ) { PF . fn . growl . str . timeoutcall = true ; PF . fn . growl . close ( ) ; } , growl _options . expires ) ; } } , expirable : function ( msg , time ) { if ( typeof msg == "undefined" ) return ; if ( typeof time == "undefined" ) time = 5000 ; PF . fn . growl . call ( { message : msg , expires : time } ) ; } , close : function ( forced , callback ) { var $growl = $ ( PF . fn . growl . selectors . root ) ; if ( forced ) { this . str . timeout = null ; this . str . timeoutcall = false ; clearTimeout ( this . str . timeout ) ; }
if ( ! $growl . exists ( ) || ( typeof this . str . timeout == "number" && ! this . str . timeoutcall ) ) { return ; }
$growl . fadeOut ( "fast" , function ( ) { $ ( this ) . remove ( ) ; if ( typeof callback == "function" ) { callback ( ) ; } } ) ; } , fixPosition : function ( ) { var $growl = $ ( PF . fn . growl . selectors . root ) ; if ( ! $growl . exists ( ) || ! $ ( PF . obj . modal . selectors . root ) . exists ( ) ) { return ; }
if ( $growl . data ( "fixedPosition" ) == "scrollbar" && $ ( PF . obj . modal . selectors . root ) . hasScrollBar ( ) . vertical ) { return ; }
var offsetX = { modal : $ ( PF . obj . modal . selectors . box ) . offset ( ) . left , growl : $growl . offset ( ) . left } , growlCompensate = offsetX . modal - offsetX . growl , marginLeft = growlCompensate < 0 ? ( "-=" + Math . abs ( growlCompensate ) ) : "-" + parseInt ( $growl . css ( "width" ) ) / 2 ; if ( ! PF . fn . isDevice ( [ "phone" , "phablet" ] ) ) { $growl . css ( "marginLeft" , marginLeft + "px" ) ; }
$growl . data ( "fixedPosition" , $ ( PF . obj . modal . selectors . root ) . hasScrollBar ( ) . vertical ? "scrollbar" : "no-scrollbar" ) ; } } ; PF . obj . modal = { type : "" , selectors : { root : "#fullscreen-modal" , box : "#fullscreen-modal-box" , body : "#fullscreen-modal-body" , login : "[data-modal=login]" , changes _confirm : "#fullscreen-changes-confirm" , btn _container : ".btn-container" , close _buttons : ".close-modal,.cancel-modal,[data-action=cancel],[data-action-close]" , submit _button : "[data-action=submit]" , growl _placeholder : "#fullscreen-growl-placeholder" } , ajax : { url : "" , deferred : { } } , locked : false , form _data : { } , XHR : { } , prevented : false } ; PF . obj . modal . $close _buttons = $ ( PF . obj . modal . selectors . close _buttons , PF . obj . modal . selectors . root ) ; PF . obj . modal . $submit _button = $ ( PF . obj . modal . selectors . submit _button , PF . obj . modal . selectors . root ) ; PF . fn . modal = { str : { transition : "all " + PF . obj . config . animation . fast + "ms ease" } , call : function ( options ) { var modal _options , modal _base _template , modal _message ; if ( typeof options == "undefined" ) return ; if ( typeof options . template !== "undefined" && typeof options . type == "undefined" ) options . type = "html" ; if ( ( typeof options . title == "undefined" || typeof options . message == "undefined" ) && ( options . type !== "login" && options . type !== "html" ) ) return ; PF . fn . growl . close ( ) ; modal _options = { forced : false , type : "confirm" , title : options . title , message : options . message , html : false , template : options . template , buttons : true , button _submit : PF . fn . _s ( "Submit" ) , txt _or : PF . fn . _s ( "or" ) , button _cancel : PF . fn . _s ( "cancel" ) , ajax : { url : null , data : null , deferred : { } } , confirm : function ( ) { } , cancel : function ( ) { PF . fn . modal . close ( ) ; } , load : function ( ) { } , callback : function ( ) { } } ; for ( key in modal _options ) { if ( typeof options [ key ] !== "undefined" ) { if ( ( /^cancel|confirm|callback$/ ) . test ( key ) ) { if ( typeof options [ key ] == "function" ) { modal _options [ key ] = options [ key ] ; } } else { modal _options [ key ] = options [ key ] ; } } }
if ( typeof options . ajax !== "undefined" && ! options . ajax . url && options . ajax . deferred ) { modal _options . ajax . url = PF . obj . config . json _api ; }
if ( modal _options . type == "login" ) { modal _options . buttons = false ; }
if ( modal _options . type == "confirm" ) { modal _options . button _submit = PF . fn . _s ( "Confirm" ) ; }
var overlay _background = "soft-black" ; if ( $ ( "html" ) . hasClass ( "tone-dark" ) ) { overlay _background = "black" ; }
var modal _base _template = [ '<div id="' , PF . obj . modal . selectors . root . replace ( "#" , "" ) , '"class="fullscreen ' + overlay _background + '"><div id="' , PF . obj . modal . selectors . box . replace ( "#" , "" ) , '"class="clickable"><div id="' , PF . obj . modal . selectors . body . replace ( "#" , "" ) , '">%MODAL_BODY%</div>%MODAL_BUTTONS%<span class="close-modal icon-close" data-action="close-modal"></span></div></div>' ] . join ( "" ) ; var modal _buttons = modal _options . buttons ? [ '<div class="' , PF . obj . modal . selectors . btn _container . replace ( "." , "" ) , '"><button class="btn btn-input default" data-action="submit" type="submit">' , modal _options . button _submit , '</button> <span class="btn-alt">' , modal _options . txt _or , '<a class="cancel" data-action="cancel">' , modal _options . button _cancel , '</a></span></div>' ] . join ( "" ) : "" ; if ( modal _options . type == "login" ) { modal _options . template = typeof modal _options . template == "undefined" ? $ ( PF . obj . modal . selectors . login ) . html ( ) : modal _options . template ; }
var modalBodyHTML ; switch ( modal _options . type ) { case "html" : case "login" : modalBodyHTML = modal _options . template ; break ; case "confirm" : default : modal _message = modal _options . message ; if ( ! modal _options . html ) { modal _message = '<p>' + modal _message + '</p>' ; }
modalBodyHTML = '<h1>' + modal _options . title + '</h1>' + modal _message ; break ; }
if ( typeof modalBodyHTML == "undefined" ) { console . log ( "PF Error: Modal content is empty" ) ; return ; }
modal _base _template = modal _base _template . replace ( "%MODAL_BODY%" , modalBodyHTML ) . replace ( "%MODAL_BUTTONS%" , modal _buttons ) . replace ( /template-tooltip/g , "tooltip" ) ; $ ( PF . obj . modal . selectors . root ) . remove ( ) ; $ ( "body" ) . data ( "overflow-hidden" , $ ( "body" ) . hasClass ( "overflow-hidden" ) ) ; $ ( "body" ) . prepend ( modal _base _template ) . addClass ( "overflow-hidden" ) ; this . fixScrollbars ( ) ; $ ( "[rel=tooltip]" , PF . obj . modal . selectors . root ) . each ( function ( ) { PF . fn . bindtipTip ( this , { content : $ ( this ) . data ( "title" ) } ) ; } ) ; if ( $ ( ":button, input[type=submit], input[type=reset]" , PF . obj . modal . selectors . root ) . length > 0 ) { var $form = $ ( "form" , PF . obj . modal . selectors . root ) ; if ( $form . exists ( ) ) { $form . append ( $ ( $ ( PF . obj . modal . selectors . btn _container , PF . obj . modal . selectors . root ) . html ( ) ) . wrapInner ( PF . obj . modal . selectors . btn _container . replace ( "." , "" ) ) ) ; $ ( PF . obj . modal . selectors . btn _container , PF . obj . modal . selectors . root ) . each ( function ( ) { if ( ! $ ( this ) . closest ( "form" ) . exists ( ) ) { $ ( this ) . remove ( ) ; } } ) ; } else { $ ( PF . obj . modal . selectors . box , PF . obj . modal . selectors . root ) . wrapInner ( '<form />' ) ; } }
modal _options . callback ( ) ; $ ( PF . obj . modal . selectors . box ) . css ( { transform : "scale(0.7)" , opacity : 0 , transition : PF . fn . modal . str . transition } ) ; $ ( PF . obj . modal . selectors . root ) . css ( { display : "block" } ) ; setTimeout ( function ( ) { $ ( PF . obj . modal . selectors . root ) . css ( { opacity : 1 } ) ; $ ( PF . obj . modal . selectors . box ) . css ( { transform : "scale(1)" , opacity : 1 } ) ; setTimeout ( function ( ) { if ( typeof modal _options . load == "function" ) { modal _options . load ( ) ; }
$ ( "html" ) . data ( "modal-form-values" , PF . fn . deparam ( $ ( ":input:visible" , PF . obj . modal . selectors . root ) . serialize ( ) ) ) ; } , PF . obj . config . animation . fast ) ; } , 1 ) ; $ ( PF . obj . modal . selectors . root ) . click ( function ( e ) { var $this = $ ( e . target ) , _this = this ; if ( PF . obj . modal . locked ) { return ; }
if ( $this . closest ( PF . obj . modal . selectors . changes _confirm ) . exists ( ) && ( $this . is ( PF . obj . modal . selectors . close _buttons ) || $this . is ( PF . obj . modal . selectors . submit _button ) ) ) { $ ( PF . obj . modal . selectors . changes _confirm ) . remove ( ) ; if ( $this . is ( PF . obj . modal . selectors . close _buttons ) ) { $ ( PF . obj . modal . selectors . box , _this ) . fadeIn ( "fast" , function ( ) { $ ( this ) . css ( "transition" , PF . fn . modal . str . transition ) ; } ) ; } else { PF . fn . modal . close ( ) ; } } else { if ( ! $this . closest ( ".clickable" ) . exists ( ) || $this . is ( PF . obj . modal . selectors . close _buttons ) ) { PF . fn . growl . close ( ) ; modal _options . cancel ( ) ; }
if ( $this . is ( PF . obj . modal . selectors . submit _button ) ) { if ( modal _options . confirm ( ) === false ) { return ; }
var modal _submit _continue = true ; if ( $ ( "input, textarea, select" , PF . obj . modal . selectors . root ) . not ( ":input[type=button], :input[type=submit], :input[type=reset]" ) . length > 0 && ! PF . fn . form _modal _has _changed ( ) && ! modal _options . forced ) { modal _submit _continue = false ; }
if ( modal _submit _continue ) { if ( modal _options . ajax . url ) { var $btn _container = $ ( PF . obj . modal . selectors . btn _container , PF . obj . modal . selectors . root ) ; PF . obj . modal . locked = true ; $btn _container . first ( ) . clone ( ) . height ( $btn _container . height ( ) ) . html ( "" ) . addClass ( "loading" ) . appendTo ( PF . obj . modal . selectors . root + " form" ) ; $btn _container . hide ( ) ; PF . obj . modal . $close _buttons . hide ( ) ; var modal _loading _msg ; switch ( PF . obj . modal . type ) { case "edit" : modal _loading _msg = PF . fn . _s ( "Saving" ) ; break ; case "confirm" : case "form" : default : modal _loading _msg = PF . fn . _s ( "Sending" ) ; break ; }
PF . fn . loading . inline ( $ ( PF . obj . modal . selectors . btn _container + ".loading" , PF . obj . modal . selectors . root ) , { size : "small" , message : modal _loading _msg , valign : "center" } ) ; $ ( PF . obj . modal . selectors . root ) . disableForm ( ) ; if ( ! $ . isEmptyObject ( PF . obj . modal . form _data ) || ( typeof options . ajax !== "undefined" && typeof options . ajax . data == "undefined" ) ) { modal _options . ajax . data = PF . obj . modal . form _data ; }
PF . obj . modal . XHR = $ . ajax ( { url : modal _options . ajax . url , type : "POST" , data : modal _options . ajax . data } ) . complete ( function ( XHR ) { PF . obj . modal . locked = false ; if ( XHR . status == 200 ) { var success _fn = typeof modal _options . ajax . deferred !== "undefined" && typeof modal _options . ajax . deferred . success !== "undefined" ? modal _options . ajax . deferred . success : null ; if ( typeof success _fn == "function" ) { PF . fn . modal . close ( function ( ) { if ( typeof success _fn == "function" ) { success _fn ( XHR ) ; } } ) ; } else if ( typeof success _fn == "object" ) { if ( typeof success _fn . before == "function" ) { success _fn . before ( XHR ) ; }
if ( typeof success _fn . done == "function" ) { success _fn . done ( XHR ) ; } } } else { $ ( PF . obj . modal . selectors . root ) . enableForm ( ) ; $ ( PF . obj . modal . selectors . btn _container + ".loading" , PF . obj . modal . selectors . root ) . remove ( ) ; $btn _container . css ( "display" , "" ) ; if ( typeof modal _options . ajax . deferred !== "undefined" && typeof modal _options . ajax . deferred . error == "function" ) { modal _options . ajax . deferred . error ( XHR ) ; } else { var message = PF . fn . _s ( "An error occurred. Please try again later." ) ; PF . fn . growl . call ( message ) ; } } } ) ; } else { PF . fn . modal . close ( modal _options . callback ( ) ) ; } } } } } ) ; } , confirm : function ( options ) { options . type = "confirm" ; if ( typeof options . title == "undefined" ) { options . title = PF . fn . _s ( "Confirm action" ) ; }
PF . fn . modal . call ( options ) ; } , simple : function ( options ) { if ( typeof options == "string" ) options = { message : options } ; if ( typeof options . buttons == "undefined" ) options . buttons = false ; if ( typeof options . title == "undefined" ) options . title = PF . fn . _s ( "information" ) ; PF . fn . modal . call ( options ) ; } , fixScrollbars : function ( ) { if ( ! $ ( PF . obj . modal . selectors . root ) . exists ( ) ) { return ; }
var $targets = { padding : $ ( ".top-bar, .fixed, .position-fixed" ) , margin : $ ( "html" ) , }
var properties = { }
if ( PF . str . ScrollBarWidth > 0 && $ ( "html" ) . hasScrollBar ( ) . vertical && ! $ ( "body" ) . data ( "overflow-hidden" ) ) { properties . padding = PF . str . ScrollBarWidth + "px" ; properties . margin = PF . str . ScrollBarWidth + "px" ; } else { properties . padding = "" ; properties . margin = "" ; }
$targets . padding . css ( { paddingRight : properties . padding } ) ; $targets . margin . css ( { marginRight : properties . margin } ) ; } , close : function ( callback ) { if ( ! $ ( PF . obj . modal . selectors . root ) . exists ( ) ) { return ; }
PF . fn . growl . close ( true ) ; $ ( "[rel=tooltip]" , PF . obj . modal . selectors . root ) . tipTip ( "hide" ) ; $ ( PF . obj . modal . selectors . box ) . css ( { transform : "scale(0.5)" , opacity : 0 } ) ; $ ( PF . obj . modal . selectors . root ) . css ( { opacity : 0 } ) ; setTimeout ( function ( ) { if ( PF . str . ScrollBarWidth > 0 && $ ( "html" ) . hasScrollBar ( ) . vertical ) { $ ( ".top-bar, .fixed, .position-fixed" ) . css ( { paddingRight : "" } ) ; }
$ ( "html" ) . css ( { marginRight : "" } ) ; if ( ! $ ( "body" ) . data ( "overflow-hidden" ) ) { $ ( "body" ) . removeClass ( "overflow-hidden" ) ; }
$ ( "body" ) . removeData ( "overflow-hidden" ) ; $ ( PF . obj . modal . selectors . root ) . remove ( ) ; if ( typeof callback == "function" ) callback ( ) ; } , PF . obj . config . animation . normal ) ; } , } ; PF . fn . popup = function ( options ) { var settings = { height : options . height || 500 , width : options . width || 650 , scrollTo : 0 , resizable : 0 , scrollbars : 0 , location : 0 } ; settings . top = ( screen . height / 2 ) - ( settings . height / 2 ) ; settings . left = ( screen . width / 2 ) - ( settings . width / 2 ) ; var settings _ = "" ; for ( var key in settings ) { settings _ += key + "=" + settings [ key ] + "," ; }
settings _ = settings _ . slice ( 0 , - 1 ) ; window . open ( options . href , "Popup" , settings _ ) ; return ; } ; PF . fn . list _fluid _width = function ( ) { if ( ! $ ( "body" ) . is _fluid ( ) ) return ; var $content _listing = $ ( PF . obj . listing . selectors . content _listing _visible ) , $pad _content _listing = $ ( PF . obj . listing . selectors . pad _content , $content _listing ) , $list _item = $ ( PF . obj . listing . selectors . list _item , $content _listing ) , list _item _width = $list _item . outerWidth ( true ) , list _item _gutter = $list _item . outerWidth ( true ) - $list _item . width ( ) ; PF . obj . listing . content _listing _ratio = parseInt ( ( $content _listing . width ( ) + list _item _gutter ) / list _item _width ) ; if ( $list _item . length < PF . obj . listing . content _listing _ratio ) { $pad _content _listing . css ( "width" , "100%" ) ; return ; }
if ( PF . fn . isDevice ( [ "tablet" , "laptop" , "desktop" ] ) ) { }
if ( PF . obj . follow _scroll . $node . hasClass ( "position-fixed" ) ) { PF . obj . follow _scroll . $node . width ( $ ( ".content-width" ) . first ( ) . width ( ) ) ; } } ; PF . obj . tabs = { hashdata : { } } ; PF . fn . show _tab = function ( tab ) { if ( typeof tab == "undefined" ) return ; var $this = $ ( "a[data-tab=" + tab + "]" , ".content-tabs" ) ; $ ( "li" , $this . closest ( "ul" ) ) . removeClass ( "current" ) ; $this . closest ( "li" ) . addClass ( "current" ) ; var $tab _content _group = $ ( "#tabbed-content-group" ) ; $target = $ ( "#" + $this . data ( "tab" ) ) ; $ ( ".tabbed-content" , $tab _content _group ) . removeClass ( "visible" ) . hide ( ) ; $ ( $target , $tab _content _group ) . addClass ( "visible" ) . show ( ) ; $ ( "[data-content=list-selection]" ) . removeClass ( "visible" ) . addClass ( "hidden" ) ; $ ( "[data-content=list-selection][data-tab=" + $this . data ( "tab" ) + "]" ) . removeClass ( "hidden" ) . addClass ( "visible" ) ; if ( $tab _content _group . exists ( ) ) { var $list _item _target = $ ( PF . obj . listing . selectors . list _item + ":not(.jsly)" , $target ) , target _fade = ! $target . hasClass ( "jsly" ) ; if ( $target . data ( "load" ) == "ajax" && $target . data ( "empty" ) !== "true" && ! $ ( PF . obj . listing . selectors . list _item , $target ) . exists ( ) ) { PF . fn . listing . queryString . stock _load ( ) ; $target . html ( PF . obj . listing . template . fill ) ; PF . fn . loading . inline ( $ ( PF . obj . listing . selectors . content _listing _loading , $target ) ) ; PF . fn . listing . queryString . stock _new ( ) ; PF . fn . listing . ajax ( ) ; } else { PF . fn . listing . queryString . stock _current ( ) ; PF . fn . listing . columnizer ( false , 0 , false ) ; $list _item _target [ target _fade ? "fadeIn" : "show" ] ( ) ; } }
PF . fn . listing . columnizerQueue ( ) ; if ( $ ( PF . obj . listing . selectors . content _listing _visible ) . data ( "queued" ) == true ) { PF . fn . listing . columnizer ( true , 0 ) ; } } ; PF . obj . listing = { columns : "" , columns _number : 1 , current _column : "" , current _column : "" , XHR : { } , query _string : PF . fn . get _url _vars ( ) , calling : false , content _listing _ratio : 1 , selectors : { sort : ".sort-listing .current [data-sort]" , content _listing : ".content-listing" , content _listing _visible : ".content-listing:visible" , content _listing _loading : ".content-listing-loading" , content _listing _load _more : ".content-listing-more" , content _listing _pagination : ".content-listing-pagination" , empty _icon : ".icon icon-drawer" , pad _content : ".pad-content-listing" , list _item : ".list-item" , } , template : { fill : $ ( "[data-template=content-listing]" ) . html ( ) , empty : $ ( "[data-template=content-listing-empty]" ) . html ( ) , loading : $ ( "[data-template=content-listing-loading]" ) . html ( ) } } ; PF . fn . listing = { } ; PF . fn . listing . show = function ( response , callback ) { $content _listing = $ ( "#content-listing-tabs" ) . exists ( ) ? $ ( PF . obj . listing . selectors . content _listing _visible , "#content-listing-tabs" ) : $ ( PF . obj . listing . selectors . content _listing ) ; PF . fn . loading . inline ( PF . obj . listing . selectors . content _listing _loading ) ; $ ( PF . obj . listing . selectors . list _item + ":not(.jsly)" , $content _listing ) . each ( function ( ) { $ ( this ) . imagesLoaded ( function ( i ) { var items = PF . obj . listing . selectors . list _item , $subjects = $ ( items + ":visible" , PF . obj . listing . selectors . content _listing _visible ) , $targets = $ ( i . elements ) ; if ( ( typeof response !== "undefined" && $ ( response . html ) . length < PF . obj . config . listing . items _per _page ) || $ ( PF . obj . listing . selectors . list _item , $content _listing ) . length < PF . obj . config . listing . items _per _page ) { PF . fn . listing . removeLoader ( $content _listing ) ; }
if ( $ ( PF . obj . listing . selectors . content _listing _pagination , $content _listing ) . is ( "[data-type=classic]" ) || ! $ ( "[data-action=load-more]" , $content _listing ) . exists ( ) ) { $ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) . remove ( ) ; }
if ( $subjects . length == 0 ) { $targets . show ( ) ; PF . fn . listing . columnizer ( false , 0 ) ; PF . obj . listing . recolumnize = true ; }
var animation _time = 0 ; PF . fn . listing . columnizer ( PF . obj . listing . recolumnize , animation _time , $subjects . length == 0 ) ; $targets . hide ( ) ; PF . obj . listing . recolumnize = false ; if ( PF . fn . isDevice ( [ "laptop" , "desktop" ] ) ) { $targets . each ( function ( ) { $ ( this ) . show ( ) . find ( ".image-container" ) . hide ( ) ; var callTime = $ . now ( ) ; var $this = $ ( this ) ; var $target = $ ( ".image-container" , $this ) ; $ ( ".image-container" , this ) . imagesLoaded ( function ( ) { var loadTime = $ . now ( ) - callTime ; if ( $subjects . length == 0 ) { if ( loadTime > PF . obj . config . animation . normal ) { $target . fadeIn ( PF . obj . config . animation . normal ) ; } else { $target . show ( ) ; } } else { $target . fadeIn ( PF . obj . config . animation . normal ) ; } } ) ; } ) ; } else { $targets . show ( ) ; }
PF . obj . listing . calling = false ; var visible _loading = $ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) . exists ( ) && ( $ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) . is _in _viewport ( ) ) ; if ( typeof PF . obj . listing . show _load _more == typeof undefined ) { PF . obj . listing . show _load _more = visible _loading ; }
$ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) [ ( visible _loading ? "add" : "remove" ) + "Class" ] ( "visibility-hidden" ) ; $ ( PF . obj . listing . selectors . content _listing _load _more , $content _listing ) [ ( PF . obj . listing . show _load _more ? "show" : "hide" ) ] ( ) ; var State = History . getState ( ) ; if ( State . data && typeof State . data . scrollTop !== "undefined" ) { if ( $ ( window ) . scrollTop ( ) !== State . data . scrollTop ) { } }
if ( typeof callback == "function" ) { callback ( ) ; } } ) } ) ; } ; PF . fn . listing . removeLoader = function ( obj ) { var remove = [ PF . obj . listing . selectors . content _listing _load _more , PF . obj . listing . selectors . content _listing _loading ] ; if ( $ ( PF . obj . listing . selectors . content _listing _pagination , $content _listing ) . is ( "[data-type=endless]" ) ) { remove . push ( PF . obj . listing . selectors . content _listing _pagination ) ; }
$ . each ( remove , function ( i , v ) { $ ( v , obj ) . remove ( ) ; } ) ; } ; PF . fn . listing . queryString = { stock _load : function ( ) { var $content _listing = $ ( PF . obj . listing . selectors . content _listing _visible ) , params = PF . fn . deparam ( $content _listing . data ( "params" ) ) ; PF . obj . listing . hidden _params = typeof $content _listing . data ( "params-hidden" ) !== "undefined" ? PF . fn . deparam ( $content _listing . data ( "params-hidden" ) ) : null ; if ( typeof PF . obj . listing . query _string . action == "undefined" ) { PF . obj . listing . query _string . action = $content _listing . data ( "action" ) || "list" ; }
if ( typeof PF . obj . listing . query _string . list == "undefined" ) { PF . obj . listing . query _string . list = $content _listing . data ( "list" ) ; }
if ( typeof PF . obj . listing . query _string . sort == "undefined" ) { if ( typeof params !== "undefined" && typeof params . sort !== "undefined" ) { PF . obj . listing . query _string . sort = params . sort ; } else { PF . obj . listing . query _string . sort = $ ( ":visible" + PF . obj . listing . selectors . sort ) . data ( "sort" ) ; } }
if ( typeof PF . obj . listing . query _string . page == "undefined" ) { PF . obj . listing . query _string . page = 1 ; }
$content _listing . data ( "page" , PF . obj . listing . query _string . page ) ; $ ( PF . obj . listing . selectors . content _listing + "[data-load=ajax]" ) . each ( function ( ) { var $sortable _switch = $ ( "[data-tab=" + $ ( this ) . attr ( "id" ) + "]" + PF . obj . listing . selectors . sort ) ; var dataParams = PF . fn . deparam ( $ ( this ) . data ( "params" ) ) , dataParamsHidden = PF . fn . deparam ( $ ( this ) . data ( "params-hidden" ) ) , params = { q : dataParams && dataParams . q ? dataParams . q : null , list : $ ( this ) . data ( "list" ) , sort : $sortable _switch . exists ( ) ? $sortable _switch . data ( "sort" ) : ( dataParams && dataParams . sort ? dataParams . sort : null ) , page : dataParams && dataParams . page ? dataParams . page : 1 } ; if ( dataParamsHidden && dataParamsHidden . list ) { delete params . list ; }
for ( var k in params ) { if ( ! params [ k ] ) delete params [ k ] ; } } ) ; for ( var k in params ) { if ( /action|list|sort|page/ . test ( k ) == false ) { PF . obj . listing . query _string [ k ] = params [ k ] ; } }
for ( var k in PF . obj . listing . hidden _params ) { if ( /action|list|sort|page/ . test ( k ) == false ) { PF . obj . listing . query _string [ k ] = PF . obj . listing . hidden _params [ k ] ; } } } , stock _new : function ( ) { var $content _listing = $ ( PF . obj . listing . selectors . content _listing _visible ) , params = PF . fn . deparam ( $content _listing . data ( "params" ) ) ; if ( $content _listing . data ( "offset" ) ) { PF . obj . listing . query _string . offset = $content _listing . data ( "offset" ) ; } else { delete PF . obj . listing . query _string . offset ; }
PF . obj . listing . query _string . action = $content _listing . data ( "action" ) || "list" ; PF . obj . listing . query _string . list = $content _listing . data ( "list" ) ; if ( typeof params !== "undefined" && typeof params . sort !== "undefined" ) { PF . obj . listing . query _string . sort = params . sort ; } else { PF . obj . listing . query _string . sort = $ ( ":visible" + PF . obj . listing . selectors . sort ) . data ( "sort" ) ; }
PF . obj . listing . query _string . page = 1 ; } , stock _current : function ( ) { this . stock _new ( ) ; PF . obj . listing . query _string . page = $ ( PF . obj . listing . selectors . content _listing _visible ) . data ( "page" ) ; } } ; PF . fn . listing . queryString . stock _load ( ) ; PF . fn . listing . ajax = function ( ) { if ( PF . obj . listing . calling == true ) { return ; }
PF . obj . listing . calling = true ; var $content _listing = $ ( PF . obj . listing . selectors . content _listing _visible ) , $pad _content _listing = $ ( PF . obj . listing . selectors . pad _content , $content _listing ) ; $ ( PF . obj . listing . selectors . content _listing _load _more , $content _listing ) . hide ( ) ; $ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) . removeClass ( "visibility-hidden" ) . show ( ) ; PF . obj . listing . XHR = $ . ajax ( { type : "POST" , data : $ . param ( $ . extend ( { } , PF . obj . listing . query _string , $ . ajaxSettings . data ) ) } ) . complete ( function ( XHR ) { var response = XHR . responseJSON ; var removePagination = function ( ) { $ ( PF . obj . listing . selectors . content _listing _loading + "," + PF . obj . listing . selectors . content _listing _pagination + ":not([data-visibility=visible])" , $content _listing ) . remove ( ) ; } , setEmptyTemplate = function ( ) { $content _listing . data ( "empty" , "true" ) . html ( PF . obj . listing . template . empty ) ; $ ( "[data-content=list-selection][data-tab=" + $content _listing . attr ( "id" ) + "]" ) . addClass ( "disabled" ) ; } ; if ( XHR . readyState == 4 && typeof response !== "undefined" ) { $ ( "[data-content=list-selection][data-tab=" + $content _listing . attr ( "id" ) + "]" ) . removeClass ( "disabled" ) ; if ( XHR . status !== 200 ) { var response _output = typeof response . error !== "undefined" && typeof response . error . message !== "undefined" ? response . error . message : "Bad request" ; PF . fn . growl . call ( "Error: " + response _output ) ; $content _listing . data ( "load" , "" ) ; }
if ( ( typeof response . html == "undefined" || response . html == "" ) && $ ( PF . obj . listing . selectors . list _item , $content _listing ) . length == 0 ) { setEmptyTemplate ( ) ; }
if ( typeof response . html == "undefined" || response . html == "" ) { removePagination ( ) ; PF . obj . listing . calling = false ; if ( typeof PF . fn . listing _end == "function" ) { PF . fn . listing _end ( ) ; }
return ; }
$content _listing . data ( { "load" : "" , "page" : PF . obj . listing . query _string . page } ) ; var url _object = $ . extend ( { } , PF . obj . listing . query _string ) ; for ( var k in PF . obj . listing . hidden _params ) { if ( typeof url _object [ k ] !== "undefined" ) { delete url _object [ k ] ; } }
delete url _object [ "action" ] ; for ( var k in url _object ) { if ( ! url _object [ k ] ) delete url _object [ k ] ; }
if ( document . URL . indexOf ( "?" + $ . param ( url _object ) ) == - 1 ) { var url = window . location . href ; url = url . split ( "?" ) [ 0 ] . replace ( /\/$/ , "" ) + "/?" + $ . param ( url _object ) ; if ( window . location . hash ) { url = url . replace ( window . location . hash , '' ) ; }
History . pushState ( { pushed : "pagination" , scrollTop : $ ( window ) . scrollTop ( ) } , document . title , url ) ; }
$ ( "a[data-tab=" + $content _listing . attr ( "id" ) + "]" ) . attr ( "href" , document . URL ) ; $pad _content _listing . append ( response . html ) ; PF . fn . listing . show ( response , function ( ) { $ ( PF . obj . listing . selectors . content _listing _loading , $content _listing ) . addClass ( "visibility-hidden" ) ; } ) ; } else { PF . obj . listing . calling = false ; $content _listing . data ( "load" , "" ) ; removePagination ( ) ; if ( $ ( PF . obj . listing . selectors . list _item , $content _listing ) . length == 0 ) { setEmptyTemplate ( ) ; }
if ( XHR . readyState !== 0 ) { PF . fn . growl . call ( PF . fn . _s ( "An error occurred. Please try again later." ) ) ; } }
if ( typeof PF . fn . listing . ajax . callback == "function" ) { PF . fn . listing . ajax . callback ( XHR ) ; } } ) ; } ; PF . fn . listing . columnizerQueue = function ( ) { $ ( PF . obj . listing . selectors . content _listing + ":hidden" ) . data ( "queued" , true ) ; } ; PF . fn . listing . refresh = function ( animation _time ) { PF . fn . listing . columnizer ( true , animation _time , false ) ; $ ( PF . obj . listing . selectors . list _item ) . show ( ) ; } ; var width = $ ( window ) . width ( ) ; PF . fn . listing . columnizer = function ( forced , animation _time , hard _forced ) { var device _to _columns = { phone : 1 , phablet : 3 , tablet : 4 , laptop : 5 , desktop : 6 , largescreen : 7 , } ; if ( typeof forced !== "boolean" ) var forced = false ; if ( typeof PF . obj . listing . mode == "undefined" ) forced = true ; if ( typeof hard _forced !== "boolean" ) { var hard _forced = false , default _hard _forced = true ; } else { var default _hard _forced = false ; }
if ( ! hard _forced && default _hard _forced ) { if ( width !== $ ( window ) . width ( ) || forced ) { hard _forced = true ; } }
if ( typeof animation _time == typeof undefined ) var animation _time = PF . obj . config . animation . normal ; var $container = $ ( "#content-listing-tabs" ) . exists ( ) ? $ ( PF . obj . listing . selectors . content _listing _visible , "#content-listing-tabs" ) : $ ( PF . obj . listing . selectors . content _listing ) , $pad _content _listing = $ ( PF . obj . listing . selectors . pad _content , $container ) , list _mode = "responsive" , $list _item = $ ( forced || hard _forced ? PF . obj . listing . selectors . list _item : PF . obj . listing . selectors . list _item + ":not(.jsly)" , $container ) ; $container . addClass ( "jsly" ) ; if ( typeof PF . obj . config . listing . device _to _columns !== "undefined" ) { device _to _columns = $ . extend ( { } , device _to _columns , PF . obj . config . listing . device _to _columns ) ; }
if ( $container . data ( "device-columns" ) ) { device _to _columns = $ . extend ( { } , device _to _columns , $container . data ( "device-columns" ) ) ; }
PF . obj . listing . mode = list _mode ; PF . obj . listing . device = PF . fn . getDeviceName ( ) ; if ( ! $list _item . exists ( ) ) return ; if ( typeof $container . data ( "columns" ) !== "undefined" && ! forced && ! hard _forced ) { PF . obj . listing . columns = $container . data ( "columns" ) ; PF . obj . listing . columns _number = $container . data ( "columns" ) . length - 1 ; PF . obj . listing . current _column = $container . data ( "current_column" ) ; } else { var $list _item _1st = $list _item . first ( ) ; $list _item _1st . css ( "width" , "" ) ; PF . obj . listing . columns = new Array ( ) ; PF . obj . listing . columns _number = device _to _columns [ PF . fn . getDeviceName ( ) ] ; for ( i = 0 ; i < PF . obj . listing . columns _number ; i ++ ) { PF . obj . listing . columns [ i + 1 ] = 0 ; }
PF . obj . listing . current _column = 1 ; }
2016-11-06 02:19:47 +00:00
var special _margin = PF . obj . listing . columns _number == 1 ? "-10px" : "" ; $ ( "#tabbed-content-group" ) . css ( { marginLeft : special _margin , marginRight : special _margin } ) ; $container . removeClass ( "small-cols" ) . addClass ( PF . obj . listing . columns _number > 6 ? "small-cols" : "" ) ; $pad _content _listing . css ( "width" , "100%" ) ; var delay = 0 ; $list _item . each ( function ( index ) { $ ( this ) . addClass ( "jsly" ) ; var $list _item _img = $ ( ".list-item-image" , this ) , $list _item _src = $ ( ".list-item-image img" , this ) , $list _item _thumbs = $ ( ".list-item-thumbs" , this ) , isJslyLoaded = $list _item _src . hasClass ( "jsly-loaded" ) ; $list _item _src . show ( ) ; if ( hard _forced ) { $ ( this ) . css ( { top : "" , left : "" , height : "" , position : "" } ) ; $list _item _img . css ( { maxHeight : "" , height : "" } ) ; $list _item _src . removeClass ( "jsly" ) . css ( { width : "" , height : "" } ) . parent ( ) . css ( { marginLeft : "" , marginTop : "" } ) ; $ ( "li" , $list _item _thumbs ) . css ( { width : "" , height : "" } ) ; }
2016-08-18 20:39:31 +00:00
var width _responsive = PF . obj . listing . columns _number == 1 ? "100%" : parseInt ( ( 1 / PF . obj . listing . columns _number ) * ( $container . width ( ) - ( 10 * ( PF . obj . listing . columns _number - 1 ) ) ) + "px" ) ; $ ( this ) . css ( "width" , width _responsive ) ; if ( PF . obj . listing . current _column > PF . obj . listing . columns _number ) { PF . obj . listing . current _column = 1 }
$ ( this ) . attr ( "data-col" , PF . obj . listing . current _column ) ; if ( ! $list _item _src . exists ( ) ) { var empty = true ; $list _item _src = $ ( ".image-container .empty" , this ) ; }
var already _shown = $ ( this ) . is ( ":visible" ) ; $list _item . show ( ) ; var isFixed = $list _item _img . hasClass ( "fixed-size" ) ; var image = { w : parseInt ( $list _item _src . attr ( "width" ) ) , h : parseInt ( $list _item _src . attr ( "height" ) ) } ; image . ratio = image . w / image . h ; if ( hard _forced && PF . obj . listing . columns _number > 1 ) { $list _item _src . css ( { width : "auto" , height : "auto" } ) ; $ ( ".image-container:not(.list-item-avatar-cover)" , this ) . css ( { width : "" , height : "auto" } ) ; } else { if ( image . w > $container . width ( ) ) { $ ( ".image-container:not(.list-item-avatar-cover)" , this ) . css ( image . ratio < 1 ? { maxWidth : "100%" , height : "auto" } : { height : "100%" , width : "auto" } ) ; $list _item _src . css ( image . ratio < 1 ? { maxWidth : "100%" , height : "auto" } : { height : "100%" , width : "auto" } ) ; } }
if ( empty || ( $list _item _img . css ( "min-height" ) && ! $list _item _src . hasClass ( "jsly" ) ) ) { var list _item _img _min _height = parseInt ( $list _item _img . css ( "height" ) ) , col = { w : $ ( this ) . width ( ) , h : isFixed ? $ ( this ) . width ( ) : null } , magicWidth = Math . min ( image . w , image . w < col . w ? image . w : col . w ) ; if ( isFixed ) { $list _item _img . css ( { height : col . w } ) ; if ( image . ratio <= 3 && ( image . ratio > 1 || image . ratio == 1 ) ) { image . h = Math . min ( image . h , image . w < col . w ? image . w : col . w ) ; image . w = image . h * image . ratio ; } else { image . w = magicWidth ; image . h = image . w / image . ratio ; }
var list _item _img _min _h = parseInt ( $list _item _img . css ( "min-height" ) ) ; $list _item _img . css ( "min-height" , 0 ) ; } else { image . w = magicWidth ; if ( image . ratio >= 3 || image . ratio < 1 || image . ratio == 1 ) { image . h = image . w / image . ratio ; } else { image . h = Math . min ( image . h , image . w ) ; image . w = image . h * image . ratio ; }
if ( empty ) { image . h = col . w ; }
$list _item _img . css ( { height : image . h } ) ; }
$list _item _src . css ( { width : image . w , height : image . h } ) ; if ( $list _item _src . width ( ) == 0 ) { $list _item _src . css ( { width : magicWidth , height : magicWidth / image . ratio } ) ; }
if ( $ ( ".image-container" , this ) . is ( ".list-item-avatar-cover" ) ) { $list _item _src . css ( isFixed ? { width : "auto" , height : "100%" } : { width : "100%" , height : "auto" } ) ; }
if ( $list _item _src . height ( ) !== 0 && ( $list _item _img . height ( ) > $list _item _src . height ( ) || isFixed ) ) { $list _item _src . parent ( ) . css ( { "marginTop" : ( $list _item _img . outerHeight ( ) - $list _item _src . height ( ) ) / 2 } ) ; }
if ( $list _item _img . width ( ) < $list _item _src . width ( ) ) { $list _item _src . parent ( ) . css ( { "marginLeft" : - ( ( $list _item _src . outerWidth ( ) - $list _item _img . width ( ) ) / 2 ) + "px" } ) ; }
var list _item _src _pitfall _x = Math . max ( $list _item _src . position ( ) . left * 2 , 0 ) , list _item _src _pitfall _y = Math . max ( $list _item _src . position ( ) . top * 2 , 0 ) ; if ( PF . obj . listing . columns _number > 6 && ( list _item _src _pitfall _x > 0 || list _item _src _pitfall _y > 0 ) ) { var pitfall _ratio _x = list _item _src _pitfall _x / $list _item _img . width ( ) , pitfall _ratio _y = list _item _src _pitfall _y / $list _item _img . height ( ) , pitfall = { } ; if ( pitfall _ratio _x <= . 25 && pitfall _ratio _y <= . 25 ) { if ( pitfall _ratio _x > pitfall _ratio _y ) { pitfall . width = list _item _src _pitfall _x + $list _item _img . width ( ) ; pitfall . height = pitfall . width / image . ratio ; } else { pitfall . height = list _item _src _pitfall _y + $list _item _src . height ( ) ; pitfall . width = pitfall . height * image . ratio ; }
$list _item _src . css ( pitfall ) ; $list _item _src . parent ( ) . css ( { "marginLeft" : - ( ( $list _item _src . width ( ) - $list _item _img . width ( ) ) / 2 ) , "marginTop" : 0 } ) ; } }
if ( $list _item _thumbs . exists ( ) ) { $ ( "li" , $list _item _thumbs ) . css ( { width : 100 / $ ( "li" , $list _item _thumbs ) . length + "%" } ) . css ( { height : $ ( "li" , $list _item _thumbs ) . width ( ) } ) ; }
if ( ! already _shown ) { $list _item . hide ( ) ; } }
if ( ! $list _item _src . hasClass ( "jsly" ) && $ ( this ) . is ( ":hidden" ) ) { $ ( this ) . css ( 'top' , "100%" ) ; }
PF . obj . listing . columns [ PF . obj . listing . current _column ] += $ ( this ) . outerHeight ( true ) ; if ( PF . obj . listing . columns _number == 1 ) { $ ( this ) . removeClass ( "position-absolute" ) ; } else { if ( $ ( this ) . is ( ":animated" ) ) { animation _time = 0 ; }
$ ( this ) . addClass ( "position-absolute" ) ; var new _left = $ ( this ) . outerWidth ( true ) * ( PF . obj . listing . current _column - 1 ) ; var must _change _left = parseInt ( $ ( this ) . css ( "left" ) ) != new _left ; if ( must _change _left ) { animate _grid = true ; $ ( this ) . animate ( { left : new _left } , animation _time ) ; }
var new _top = PF . obj . listing . columns [ PF . obj . listing . current _column ] - $ ( this ) . outerHeight ( true ) ; if ( parseInt ( $ ( this ) . css ( "top" ) ) != new _top ) { animate _grid = true ; $ ( this ) . animate ( { top : new _top } , animation _time ) ; if ( must _change _left ) { delay = 1 ; } } }
if ( already _shown ) { $list _item . show ( ) ; }
if ( ! isJslyLoaded ) { $list _item _src . addClass ( "jsly" ) . hide ( ) . imagesLoaded ( function ( i ) { $ ( i . elements ) . show ( ) . addClass ( "jsly-loaded" ) ; } ) ; }
if ( ! isFixed ) { var minCol , minH , currentH ; for ( var i = 1 ; i <= PF . obj . listing . columns _number ; i ++ ) { currentH = PF . obj . listing . columns [ i ] ; if ( typeof minH == "undefined" ) { minH = currentH ; minCol = i ; }
if ( PF . obj . listing . columns [ i ] == 0 ) { minCol = i ; break ; }
if ( currentH < minH ) { minH = PF . obj . listing . columns [ i ] ; minCol = i ; } }
PF . obj . listing . current _column = minCol ; } else { PF . obj . listing . current _column ++ ; } } ) ; $container . data ( { "columns" : PF . obj . listing . columns , "current_column" : PF . obj . listing . current _column } ) ; var content _listing _height = 0 ; $ . each ( PF . obj . listing . columns , function ( i , v ) { if ( v > content _listing _height ) { content _listing _height = v ; } } ) ; if ( content _listing _height > 10 ) { content _listing _height -= 10 ; }
PF . obj . listing . width = $container . width ( ) ; if ( typeof PF . obj . listing . height !== typeof undefined ) { var old _listing _height = PF . obj . listing . height ; }
PF . obj . listing . height = content _listing _height ; var do _listing _h _resize = typeof old _listing _height !== typeof undefined && old _listing _height !== PF . obj . listing . height ; if ( ! do _listing _h _resize ) { $pad _content _listing . height ( content _listing _height ) ; PF . fn . list _fluid _width ( ) ; }
if ( do _listing _h _resize ) { $pad _content _listing . height ( old _listing _height ) ; setTimeout ( function ( ) { $pad _content _listing . animate ( { height : content _listing _height } , animation _time , function ( ) { PF . fn . list _fluid _width ( ) ; } ) ; } , animation _time * delay ) ; }
$container . data ( "list-mode" , PF . obj . listing . mode ) ; $ ( PF . obj . listing . selectors . content _listing _visible ) . data ( "queued" , false ) ; } ; PF . fn . loading = { spin : { small : { lines : 11 , length : 0 , width : 3 , radius : 7 , speed : 1 , trail : 45 , blocksize : 20 } , normal : { lines : 11 , length : 0 , width : 5 , radius : 10 , speed : 1 , trail : 45 , blocksize : 30 } , big : { lines : 11 , length : 0 , width : 7 , radius : 13 , speed : 1 , trail : 45 , blocksize : 40 } , huge : { lines : 11 , length : 0 , width : 9 , radius : 16 , speed : 1 , trail : 45 , blocksize : 50 } } , inline : function ( $target , options ) { if ( typeof $target == "undefined" ) return ; if ( $target instanceof jQuery == false ) { var $target = $ ( $target ) ; }
var defaultoptions = { size : "normal" , color : $ ( "body" ) . css ( "color" ) , center : false , position : "absolute" , shadow : false , valign : "top" } ; if ( typeof options == "undefined" ) { options = defaultoptions ; } else { for ( var k in defaultoptions ) { if ( typeof options [ k ] == "undefined" ) { options [ k ] = defaultoptions [ k ] ; } } }
var size = PF . fn . loading . spin [ options . size ] ; PF . fn . loading . spin [ options . size ] . color = options . color ; PF . fn . loading . spin [ options . size ] . shadow = options . shadow ; $target . html ( '<span class="loading-indicator"></span>' + ( typeof options . message !== "undefined" ? '<span class="loading-text">' + options . message + '</span>' : '' ) ) . css ( { "line-height" : PF . fn . loading . spin [ options . size ] . blocksize + "px" } ) ; $ ( ".loading-indicator" , $target ) . css ( { width : PF . fn . loading . spin [ options . size ] . blocksize , height : PF . fn . loading . spin [ options . size ] . blocksize } ) . spin ( PF . fn . loading . spin [ options . size ] ) ; if ( options . center ) { $ ( ".loading-indicator" , $target . css ( "textAlign" , "center" ) ) . css ( { position : options . position , top : "50%" , left : "50%" , marginTop : - ( PF . fn . loading . spin [ options . size ] . blocksize / 2 ) , marginLeft : - ( PF . fn . loading . spin [ options . size ] . blocksize / 2 ) } ) ; }
if ( options . valign == "center" ) { $ ( ".loading-indicator,.loading-text" , $target ) . css ( "marginTop" , ( $target . height ( ) - PF . fn . loading . spin [ options . size ] . blocksize ) / 2 + "px" ) ; }
2016-11-06 02:19:47 +00:00
$ ( ".spinner" , $target ) . css ( { top : PF . fn . loading . spin [ options . size ] . blocksize / 2 + "px" , left : PF . fn . loading . spin [ options . size ] . blocksize / 2 + "px" } ) ; } , fullscreen : function ( ) { $ ( "body" ) . append ( '<div class="fullscreen" id="pf-fullscreen-loader"><div class="fullscreen-loader black-bkg"><span class="loading-txt">' + PF . fn . _s ( "loading" ) + '</span></div></div>' ) ; $ ( ".fullscreen-loader" , "#pf-fullscreen-loader" ) . spin ( PF . fn . loading . spin . huge ) ; $ ( "#pf-fullscreen-loader" ) . css ( "opacity" , 1 ) ; } , destroy : function ( $target ) { var $loader _fs = $ ( "#pf-fullscreen-loader" ) , $loader _os = $ ( "#pf-onscreen-loader" ) ; if ( $target == "fullscreen" ) $target = $loader _fs ; if ( $target == "onscreen" ) $target = $loader _os ; if ( typeof $target !== "undefined" ) { $target . remove ( ) ; } else { $loader _fs . remove ( ) ; $loader _os . remove ( ) ; } } } ; jQuery . fn . disableForm = function ( ) { $ ( this ) . data ( "disabled" , true ) ; $ ( ":input" , this ) . each ( function ( ) { $ ( this ) . attr ( "disabled" , true ) ; } ) ; return this ; } ; jQuery . fn . enableForm = function ( ) { $ ( this ) . data ( "disabled" , false ) ; $ ( ":input" , this ) . removeAttr ( "disabled" ) ; return this ; } ; PF . obj . follow _scroll = { Y : 0 , y : 0 , $node : $ ( ".follow-scroll" ) , node _h : 0 , base _h : $ ( ".follow-scroll" ) . outerHeight ( ) , set : function ( reset ) { if ( reset ) { PF . obj . follow _scroll . base _h = $ ( ".follow-scroll" ) . outerHeight ( ) ; }
var exists = PF . obj . follow _scroll . $node . closest ( ".follow-scroll-wrapper" ) . exists ( ) ; if ( exists ) { PF . obj . follow _scroll . $node . closest ( ".follow-scroll-wrapper" ) . css ( "position" , "static" ) ; }
PF . obj . follow _scroll . y = PF . obj . follow _scroll . $node . exists ( ) ? PF . obj . follow _scroll . $node . offset ( ) . top : null ; PF . obj . follow _scroll . node _h = PF . obj . follow _scroll . $node . outerHeight ( ) ; if ( exists ) { PF . obj . follow _scroll . $node . closest ( ".follow-scroll-wrapper" ) . css ( "position" , "" ) ; } } , checkDocumentHeight : function ( ) { var lastHeight = document . body . clientHeight , newHeight , timer ; ( function run ( ) { newHeight = document . body . clientHeight ; if ( lastHeight != newHeight ) { PF . obj . follow _scroll . set ( ) ; }
lastHeight = newHeight ; timer = setTimeout ( run , 200 ) ; } ) ( ) ; } } ; PF . obj . follow _scroll . set ( ) ; PF . obj . follow _scroll . process = function ( forced ) { if ( forced ) { PF . obj . follow _scroll . node _h = PF . obj . follow _scroll . base _h ; }
if ( ! PF . obj . follow _scroll . $node . exists ( ) ) return ; var $parent = PF . obj . follow _scroll . $node . closest ( "[data-content=follow-scroll-parent]" ) ; if ( ! $parent . exists ( ) ) { $parent = PF . obj . follow _scroll . $node . closest ( ".content-width" ) ; }
var $wrapper = PF . obj . follow _scroll . $node . closest ( '.follow-scroll-wrapper' ) ; var top = PF . obj . follow _scroll . node _h ; var cond = $ ( window ) . scrollTop ( ) > PF . obj . follow _scroll . y - top ; if ( $ ( "#top-bar" ) . css ( "position" ) !== "fixed" ) { PF . obj . follow _scroll . Y -= $ ( window ) . scrollTop ( ) ; if ( PF . obj . follow _scroll . Y < 0 ) PF . obj . follow _scroll . Y = 0 ; cond = cond && $ ( window ) . scrollTop ( ) > PF . obj . follow _scroll . y ; }
if ( ( cond && $wrapper . hasClass ( "position-fixed" ) ) || ( ! cond && ! $wrapper . hasClass ( "position-fixed" ) ) ) { return ; }
2016-08-18 20:39:31 +00:00
if ( ! $wrapper . exists ( ) ) { PF . obj . follow _scroll . $node . wrapAll ( '<div class="follow-scroll-wrapper" />' ) ; $wrapper = PF . obj . follow _scroll . $node . closest ( '.follow-scroll-wrapper' ) ; }
2016-11-06 02:19:47 +00:00
$wrapper . css ( "min-height" , PF . obj . follow _scroll . node _h ) ; PF . obj . follow _scroll . Y = $ ( "#top-bar" ) . outerHeight ( true ) + parseFloat ( $ ( "#top-bar" ) . css ( "top" ) ) ; if ( cond ) { var placeholderHeight = PF . obj . follow _scroll . node _h ; $wrapper . addClass ( "position-fixed" ) . css ( { top : PF . obj . follow _scroll . Y } ) ; if ( ! $wrapper . next ( ) . is ( ".follow-scroll-placeholder" ) ) { $wrapper . after ( $ ( '<div class="follow-scroll-placeholder" />' ) . css ( "min-height" , placeholderHeight ) ) ; } else { $wrapper . parent ( ) . find ( ".follow-scroll-placeholder" ) . show ( ) ; } } else { $wrapper . removeClass ( "position-fixed" ) . css ( { top : "" , width : "" , minHeight : "" } ) ; $wrapper . parent ( ) . find ( ".follow-scroll-placeholder" ) . hide ( ) ; }
2016-08-18 20:39:31 +00:00
$ ( "[data-show-on=follow-scroll]" ) [ ( cond ? "remove" : "add" ) + "Class" ] ( "hidden soft-hidden" ) ; if ( ! $ ( "html" ) . data ( "top-bar-box-shadow-prevent" ) ) { $ ( "html" ) [ ( cond ? "add" : "remove" ) + "Class" ] ( "top-bar-box-shadow-none" ) ; }
PF . obj . follow _scroll . $node [ ( cond ? "add" : "remove" ) + "Class" ] ( "content-width" ) ; } ; PF . fn . isDevice = function ( device ) { if ( typeof device == "object" ) { var device = '.' + device . join ( ",." ) ; } else { var device = '.' + device ; }
return $ ( "html" ) . is ( device ) ; } ; PF . fn . getDeviceName = function ( ) { var current _device ; $ . each ( PF . obj . devices , function ( i , v ) { if ( PF . fn . isDevice ( v ) ) { current _device = v ; return true ; } } ) ; return current _device ; } ; PF . fn . topMenu = { vars : { $button : $ ( "[data-action=top-bar-menu-full]" , "#top-bar" ) , menu : "#menu-fullscreen" , speed : PF . obj . config . animation . fast , menu _top : ( parseInt ( $ ( "#top-bar" ) . outerHeight ( ) ) + parseInt ( $ ( "#top-bar" ) . css ( "top" ) ) + parseInt ( $ ( "#top-bar" ) . css ( "margin-top" ) ) + parseInt ( $ ( "#top-bar" ) . css ( "margin-bottom" ) ) - parseInt ( $ ( "#top-bar" ) . css ( "border-bottom-width" ) ) ) + "px" } , show : function ( speed ) { if ( $ ( "body" ) . is ( ":animated" ) ) return ; if ( typeof speed == "undefined" ) { var speed = this . vars . speed ; }
2016-11-06 02:19:47 +00:00
this . vars . $button . addClass ( "current" ) ; $ ( "#top-bar" ) . css ( "position" , "fixed" ) . append ( $ ( "<div/>" , { id : "menu-fullscreen" , "class" : "touch-scroll" , html : $ ( '<ul/>' , { html : $ ( ".top-bar-left" ) . html ( ) + $ ( ".top-bar-right" ) . html ( ) } ) } ) . css ( { borderTopWidth : this . vars . menu _top , left : "-100%" , } ) ) ; var $menu = $ ( this . vars . menu ) ; $ ( "li.phone-hide, li > .top-btn-text, li > .top-btn-text > span, li > a > .top-btn-text > span" , $menu ) . each ( function ( ) { $ ( this ) . removeClass ( "phone-hide" ) ; } ) ; $ ( "[data-action=top-bar-menu-full]" , $menu ) . remove ( ) ; $ ( ".btn.black, .btn.default, .btn.blue, .btn.green, .btn.orange, .btn.red, .btn.transparent" , $menu ) . removeClass ( "btn black default blue green orange red transparent" ) ; setTimeout ( function ( ) { $menu . css ( { transform : "translate(100%, 0)" } ) ; } , 1 ) ; setTimeout ( function ( ) { $ ( "html" ) . css ( { backgroundColor : "" } ) ; } , this . vars . speed ) ; } , hide : function ( speed ) { if ( $ ( "body" ) . is ( ":animated" ) ) return ; if ( ! $ ( this . vars . menu ) . is ( ":visible" ) ) return ; if ( typeof speed == "undefined" ) { var speed = this . vars . speed ; }
$ ( "#top-bar" ) . css ( "position" , "" ) ; this . vars . $button . removeClass ( "current" ) ; var $menu = $ ( this . vars . menu ) ; $menu . css ( { transform : "none" } ) ; setTimeout ( function ( ) { $menu . remove ( ) ; } , speed ) ; } } ; function sprintf ( ) { var e = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g ; var t = arguments ; var n = 0 ; var r = t [ n ++ ] ; var i = function ( e , t , n , r ) { if ( ! n ) { n = " " } var i = e . length >= t ? "" : ( new Array ( 1 + t - e . length >>> 0 ) ) . join ( n ) ; return r ? e + i : i + e } ; var s = function ( e , t , n , r , s , o ) { var u = r - e . length ; if ( u > 0 ) { if ( n || ! s ) { e = i ( e , r , o , n ) } else { e = e . slice ( 0 , t . length ) + i ( "" , u , "0" , true ) + e . slice ( t . length ) } } return e } ; var o = function ( e , t , n , r , o , u , a ) { var f = e >>> 0 ; n = n && f && { 2 : "0b" , 8 : "0" , 16 : "0x" } [ t ] || "" ; e = n + i ( f . toString ( t ) , u || 0 , "0" , false ) ; return s ( e , n , r , o , a ) } ; var u = function ( e , t , n , r , i , o ) { if ( r != null ) { e = e . slice ( 0 , r ) } return s ( e , "" , t , n , i , o ) } ; var a = function ( e , r , a , f , l , c , h ) { var p , d , v , m , g ; if ( e === "%%" ) { return "%" } var y = false ; var b = "" ; var w = false ; var E = false ; var S = " " ; var x = a . length ; for ( var T = 0 ; a && T < x ; T ++ ) { switch ( a . charAt ( T ) ) { case " " : b = " " ; break ; case "+" : b = "+" ; break ; case "-" : y = true ; break ; case "'" : S = a . charAt ( T + 1 ) ; break ; case "0" : w = true ; S = "0" ; break ; case "#" : E = true ; break } } if ( ! f ) { f = 0 } else if ( f === "*" ) { f = + t [ n ++ ] } else if ( f . charAt ( 0 ) == "*" ) { f = + t [ f . slice ( 1 , - 1 ) ] } else { f = + f } if ( f < 0 ) { f = - f ; y = true } if ( ! isFinite ( f ) ) { throw new Error ( "sprintf: (minimum-)width must be finite" ) } if ( ! c ) { c = "fFeE" . indexOf ( h ) > - 1 ? 6 : h === "d" ? 0 : undefined } else if ( c === "*" ) { c = + t [ n ++ ] } else if ( c . charAt ( 0 ) == "*" ) { c = + t [ c . slice ( 1 , - 1 ) ] } else { c = + c } g = r ? t [ r . slice ( 0 , - 1 ) ] : t [ n ++ ] ; switch ( h ) { case "s" : return u ( String ( g ) , y , f , c , w , S ) ; case "c" : return u ( String . fromCharCode ( + g ) , y , f , c , w ) ; case "b" : return o ( g , 2 , E , y , f , c , w ) ; case "o" : return o ( g , 8 , E , y , f , c , w ) ; case "x" : return o ( g , 16 , E , y , f , c , w ) ; case "X" : return o ( g , 16 , E , y , f , c , w ) . toUpperCase ( ) ; case "u" : return o ( g , 10 , E , y , f , c , w ) ; case "i" : case "d" : p = + g || 0 ; p = Math . round ( p - p % 1 ) ; d = p < 0 ? "-" : b ; g = d + i ( String ( Math . abs ( p ) ) , c , "0" , false ) ; return s ( g , d , y , f , w ) ; case "e" : case "E" : case "f" : case "F" : case "g" : case "G" : p = + g ; d = p < 0 ? "-" : b ; v = [ "toExponential" , "toFixed" , "toPrecision" ] [ "efg" . indexOf ( h . toLowerCase ( ) ) ] ; m = [ "toString" , "toUpperCase" ] [ "eEfFgG" . indexOf ( h ) % 2 ] ; g = d + Math . abs ( p ) [ v ] ( c ) ; return s ( g , d , y , f , w ) [ m ] ( ) ; default : return e } } ; return r . replace ( e , a ) } ; ! function ( t , e ) { "function" == typeof define && define . amd ? define ( "ev-emitter/ev-emitter" , e ) : "object" == typeof module && module . exports ? module . exports = e ( ) : t . EvEmitter = e ( ) } ( this , function ( ) { function t ( ) { } var e = t . prototype ; return e . on = function ( t , e ) { if ( t && e ) { var i = this . _events = this . _events || { } , n = i [ t ] = i [ t ] || [ ] ; return - 1 == n . indexOf ( e ) && n . push ( e ) , this } } , e . once = function ( t , e ) { if ( t && e ) { this . on ( t , e ) ; var i = this . _onceEvents = this . _onceEvents || { } , n = i [ t ] = i [ t ] || [ ] ; return n [ e ] = ! 0 , this } } , e . off = function ( t , e ) { var i = this . _events && this . _events [ t ] ; if ( i && i . length ) { var n = i . indexOf ( e ) ; return - 1 != n && i . splice ( n , 1 ) , this } } , e . emitEvent = function ( t , e ) { var i = this . _events && this . _events [ t ] ; if ( i && i . length ) { var n = 0 , o = i [ n ] ; e = e || [ ] ; for ( var r = this . _onceEvents && this . _onceEvents [ t ] ; o ; ) { var s = r && r [ o ] ; s && ( this . off ( t , o ) , delete r [ o ] ) , o . apply ( this , e ) , n += s ? 0 : 1 , o = i [ n ] } return this } } , t } ) , function ( t , e ) { "use strict" ; "function" == typeof define && define . amd ? define ( [ "ev-emitter/ev-emitter" ] , function ( i ) { return e ( t , i ) } ) : "object" == typeof module && module . exports ? module . exports = e ( t , require ( "ev-emitter" ) ) : t . imagesLoaded = e ( t , t . EvEmitter ) } ( window , function ( t , e ) { function i ( t , e ) { for ( var i in e ) t [ i ] = e [ i ] ; return t } function n ( t ) { var e = [ ] ; if ( Array . isArray ( t ) ) e = t ; else if ( "number" == typeof t . length ) for ( var i = 0 ; i < t . length ; i ++ ) e . push ( t [ i ] ) ; else e . push ( t ) ; return e } function o ( t , e , r ) { return this instanceof o ? ( "string" == typeof t && ( t = document . querySelectorAll ( t ) ) , this . elements = n ( t ) , this . options = i ( { } , this . options ) , "function" == typeof e ? r = e : i ( this . options , e ) , r && this . on ( "always" , r ) , this . getImages ( ) , h && ( this . jqDeferred = new h . Deferred ) , void setTimeout ( function ( ) { this . check ( ) } . bind ( this ) ) ) : new o ( t , e , r ) } function r ( t ) { this . img = t } function s ( t , e ) { this . url = t , this . element = e , this . img = new Image } var h = t . jQuery , a = t . console ; o . prototype = Object . create ( e . prototype ) , o . prototype . options = { } , o . prototype . getImages = function ( ) { this . images = [ ] , this . elements . forEach ( this . addElementImages , this ) } , o . prototype . addElementImages = function ( t )
2016-08-18 20:39:31 +00:00
barWidth ) } ; Scrollbar . Horizontal . prototype . mousewheel = function ( ev , delta , x , y ) { if ( x < 0 && 0 == this . pane . inner . get ( 0 ) . scrollLeft || x > 0 && this . innerEl . scrollLeft + Math . ceil ( this . pane . el . width ( ) ) == this . innerEl . scrollWidth ) { ev . preventDefault ( ) ; return false } } ; Scrollbar . Vertical = function ( pane ) { this . el = $ ( '<div class="antiscroll-scrollbar antiscroll-scrollbar-vertical">' , pane . el ) ; Scrollbar . call ( this , pane ) } ; inherits ( Scrollbar . Vertical , Scrollbar ) ; Scrollbar . Vertical . prototype . update = function ( ) { var paneHeight = this . pane . el . height ( ) , trackHeight = paneHeight - this . pane . padding * 2 , innerEl = this . innerEl ; var scrollbarHeight = trackHeight * paneHeight / innerEl . scrollHeight ; scrollbarHeight = scrollbarHeight < 20 ? 20 : scrollbarHeight ; var topPos = trackHeight * innerEl . scrollTop / innerEl . scrollHeight ; if ( topPos + scrollbarHeight > trackHeight ) { var diff = topPos + scrollbarHeight - trackHeight ; topPos = topPos - diff - 3 } this . el . css ( "height" , scrollbarHeight ) . css ( "top" , topPos ) ; return paneHeight < innerEl . scrollHeight } ; Scrollbar . Vertical . prototype . mousemove = function ( ev ) { var paneHeight = this . pane . el . height ( ) , trackHeight = paneHeight - this . pane . padding * 2 , pos = ev . pageY - this . startPageY , barHeight = this . el . height ( ) , innerEl = this . innerEl ; var y = Math . min ( Math . max ( pos , 0 ) , trackHeight - barHeight ) ; innerEl . scrollTop = ( innerEl . scrollHeight - paneHeight ) * y / ( trackHeight - barHeight ) } ; Scrollbar . Vertical . prototype . mousewheel = function ( ev , delta , x , y ) { if ( y > 0 && 0 == this . innerEl . scrollTop || y < 0 && this . innerEl . scrollTop + Math . ceil ( this . pane . el . height ( ) ) == this . innerEl . scrollHeight ) { ev . preventDefault ( ) ; return false } } ; function inherits ( ctorA , ctorB ) { function f ( ) { } f . prototype = ctorB . prototype ; ctorA . prototype = new f } var size ; function scrollbarSize ( ) { if ( size === undefined ) { var div = $ ( '<div class="antiscroll-inner" style="width:50px;height:50px;overflow-y:scroll;' + 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%">' + "</div>" ) ; $ ( "body" ) . append ( div ) ; var w1 = $ ( div ) . innerWidth ( ) ; var w2 = $ ( "div" , div ) . innerWidth ( ) ; $ ( div ) . remove ( ) ; size = w1 - w2 } return size } } ) ( jQuery ) ; ( function ( factory ) { if ( typeof define === "function" && define . amd ) define ( [ "jquery" ] , factory ) ; else if ( typeof exports === "object" ) module . exports = factory ; else factory ( jQuery ) } ) ( function ( $ ) { var toFix = [ "wheel" , "mousewheel" , "DOMMouseScroll" , "MozMousePixelScroll" ] ; var toBind = "onwheel" in document || document . documentMode >= 9 ? [ "wheel" ] : [ "mousewheel" , "DomMouseScroll" , "MozMousePixelScroll" ] ; var lowestDelta , lowestDeltaXY ; if ( $ . event . fixHooks ) for ( var i = toFix . length ; i ; ) $ . event . fixHooks [ toFix [ -- i ] ] = $ . event . mouseHooks ; $ . event . special . mousewheel = { setup : function ( ) { if ( this . addEventListener ) for ( var i = toBind . length ; i ; ) this . addEventListener ( toBind [ -- i ] , handler , false ) ; else this . onmousewheel = handler } , teardown : function ( ) { if ( this . removeEventListener ) for ( var i = toBind . length ; i ; ) this . removeEventListener ( toBind [ -- i ] , handler , false ) ; else this . onmousewheel = null } } ; $ . fn . extend ( { mousewheel : function ( fn ) { return fn ? this . bind ( "mousewheel" , fn ) : this . trigger ( "mousewheel" ) } , unmousewheel : function ( fn ) { return this . unbind ( "mousewheel" , fn ) } } ) ; function handler ( event ) { var orgEvent = event || window . event , args = [ ] . slice . call ( arguments , 1 ) , delta = 0 , deltaX = 0 , deltaY = 0 , absDelta = 0 , absDeltaXY = 0 , fn ; event = $ . event . fix ( orgEvent ) ; event . type = "mousewheel" ; if ( orgEvent . wheelDelta ) delta = orgEvent . wheelDelta ; if ( orgEvent . detail ) delta = orgEvent . detail * - 1 ; if ( orgEvent . deltaY ) { deltaY = orgEvent . deltaY * - 1 ; delta = deltaY } if ( orgEvent . deltaX ) { deltaX = orgEvent . deltaX ; delta = deltaX * - 1 } if ( orgEvent . wheelDeltaY !== undefined ) deltaY = orgEvent . wheelDeltaY ; if ( orgEvent . wheelDeltaX !== undefined ) deltaX = orgEvent . wheelDeltaX * - 1 ; absDelta = Math . abs ( delta ) ; if ( ! lowestDelta || absDelta < lowestDelta ) lowestDelta = absDelta ; absDeltaXY = Math . max ( Math . abs ( deltaY ) , Math . abs ( deltaX ) ) ; if ( ! lowestDeltaXY || absDeltaXY < lowestDeltaXY ) lowestDeltaXY = absDeltaXY ; fn = delta > 0 ? "floor" : "ceil" ; delta = Math [ fn ] ( delta / lowestDelta ) ; deltaX = Math [ fn ] ( deltaX / lowestDeltaXY ) ; deltaY = Math [ fn ] ( deltaY / lowestDeltaXY ) ; args . unshift ( event , delta , deltaX , deltaY ) ; return ( $ . event . dispatch || $ . event . handle ) . apply ( this , args ) } } ) ; ( function ( $ ) { $ . fn . delayedAction = function ( options )
{ var settings = $ . extend ( { } , { delayedAction : function ( ) { } , cancelledAction : function ( ) { } , hoverTime : 1000 } , options ) ; return this . each ( function ( ) { var $this = $ ( this ) ; $this . hover ( function ( ) { $this . data ( 'timerId' , setTimeout ( function ( ) { $this . data ( 'hover' , false ) ; settings . delayedAction ( $this ) ; } , settings . hoverTime ) ) ; $this . data ( 'hover' , true ) ; } , function ( ) { if ( $this . data ( 'hover' ) ) { clearTimeout ( $this . data ( 'timerId' ) ) ; settings . cancelledAction ( $this ) ; }
$this . data ( 'hover' , false ) ; } ) ; } ) ; } } ) ( jQuery ) ; function testPassword ( e ) { var t = 0 , n = "weak" , r = "" , i = 0 ; if ( e . length < 5 ) { t = t + 3 ; r = r + "3 points for length (" + e . length + ")\n" } else if ( e . length > 4 && e . length < 8 ) { t = t + 6 ; r = r + "6 points for length (" + e . length + ")\n" } else if ( e . length > 7 && e . length < 16 ) { t = t + 12 ; r = r + "12 points for length (" + e . length + ")\n" } else if ( e . length > 15 ) { t = t + 18 ; r = r + "18 point for length (" + e . length + ")\n" } if ( e . match ( /[a-z]/ ) ) { t = t + 1 ; r = r + "1 point for at least one lower case char\n" } if ( e . match ( /[A-Z]/ ) ) { t = t + 5 ; r = r + "5 points for at least one upper case char\n" } if ( e . match ( /\d+/ ) ) { t = t + 5 ; r = r + "5 points for at least one number\n" } if ( e . match ( /(.*[0-9].*[0-9].*[0-9])/ ) ) { t = t + 5 ; r = r + "5 points for at least three numbers\n" } if ( e . match ( /.[!,@,#,$,%,^,&,*,?,_,~]/ ) ) { t = t + 5 ; r = r + "5 points for at least one special char\n" } if ( e . match ( /(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/ ) ) { t = t + 5 ; r = r + "5 points for at least two special chars\n" } if ( e . match ( /([a-z].*[A-Z])|([A-Z].*[a-z])/ ) ) { t = t + 2 ; r = r + "2 combo points for upper and lower letters\n" } if ( e . match ( /([a-zA-Z])/ ) && e . match ( /([0-9])/ ) ) { t = t + 2 ; r = r + "2 combo points for letters and numbers\n" } if ( e . match ( /([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/ ) ) { t = t + 2 ; r = r + "2 combo points for letters, numbers and special chars\n" } if ( e . length == 0 ) { t = 0 } if ( t < 16 ) { n = "very weak" } else if ( t > 15 && t < 25 ) { n = "weak" } else if ( t > 24 && t < 35 ) { n = "average" } else if ( t > 34 && t < 45 ) { n = "strong" } else { n = "stronger" } i = Math . round ( Math . min ( 100 , 100 * t / 45 ) ) / 100 ; return { score : t , ratio : i , percent : i * 100 + "%" , verdict : n , log : r } }
( function ( factory ) { if ( typeof exports === "object" ) { module . exports = factory ( ) } else if ( typeof define === "function" && define . amd ) { define ( factory ) } else { var glob ; try { glob = window } catch ( e ) { glob = self } glob . SparkMD5 = factory ( ) } } ) ( function ( undefined ) { "use strict" ; var add32 = function ( a , b ) { return a + b & 4294967295 } , hex _chr = [ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "a" , "b" , "c" , "d" , "e" , "f" ] ; function cmn ( q , a , b , x , s , t ) { a = add32 ( add32 ( a , q ) , add32 ( x , t ) ) ; return add32 ( a << s | a >>> 32 - s , b ) } function ff ( a , b , c , d , x , s , t ) { return cmn ( b & c | ~ b & d , a , b , x , s , t ) } function gg ( a , b , c , d , x , s , t ) { return cmn ( b & d | c & ~ d , a , b , x , s , t ) } function hh ( a , b , c , d , x , s , t ) { return cmn ( b ^ c ^ d , a , b , x , s , t ) } function ii ( a , b , c , d , x , s , t ) { return cmn ( c ^ ( b | ~ d ) , a , b , x , s , t ) } function md5cycle ( x , k ) { var a = x [ 0 ] , b = x [ 1 ] , c = x [ 2 ] , d = x [ 3 ] ; a = ff ( a , b , c , d , k [ 0 ] , 7 , - 680876936 ) ; d = ff ( d , a , b , c , k [ 1 ] , 12 , - 389564586 ) ; c = ff ( c , d , a , b , k [ 2 ] , 17 , 606105819 ) ; b = ff ( b , c , d , a , k [ 3 ] , 22 , - 1044525330 ) ; a = ff ( a , b , c , d , k [ 4 ] , 7 , - 176418897 ) ; d = ff ( d , a , b , c , k [ 5 ] , 12 , 1200080426 ) ; c = ff ( c , d , a , b , k [ 6 ] , 17 , - 1473231341 ) ; b = ff ( b , c , d , a , k [ 7 ] , 22 , - 45705983 ) ; a = ff ( a , b , c , d , k [ 8 ] , 7 , 1770035416 ) ; d = ff ( d , a , b , c , k [ 9 ] , 12 , - 1958414417 ) ; c = ff ( c , d , a , b , k [ 10 ] , 17 , - 42063 ) ; b = ff ( b , c , d , a , k [ 11 ] , 22 , - 1990404162 ) ; a = ff ( a , b , c , d , k [ 12 ] , 7 , 1804603682 ) ; d = ff ( d , a , b , c , k [ 13 ] , 12 , - 40341101 ) ; c = ff ( c , d , a , b , k [ 14 ] , 17 , - 1502002290 ) ; b = ff ( b , c , d , a , k [ 15 ] , 22 , 1236535329 ) ; a = gg ( a , b , c , d , k [ 1 ] , 5 , - 165796510 ) ; d = gg ( d , a , b , c , k [ 6 ] , 9 , - 1069501632 ) ; c = gg ( c , d , a , b , k [ 11 ] , 14 , 643717713 ) ; b = gg ( b , c , d , a , k [ 0 ] , 20 , - 373897302 ) ; a = gg ( a , b , c , d , k [ 5 ] , 5 , - 701558691 ) ; d = gg ( d , a , b , c , k [ 10 ] , 9 , 38016083 ) ; c = gg ( c , d , a , b , k [ 15 ] , 14 , - 660478335 ) ; b = gg ( b , c , d , a , k [ 4 ] , 20 , - 405537848 ) ; a = gg ( a , b , c , d , k [ 9 ] , 5 , 568446438 ) ; d = gg ( d , a , b , c , k [ 14 ] , 9 , - 1019803690 ) ; c = gg ( c , d , a , b , k [ 3 ] , 14 , - 187363961 ) ; b = gg ( b , c , d , a , k [ 8 ] , 20 , 1163531501 ) ; a = gg ( a , b , c , d , k [ 13 ] , 5 , - 1444681467 ) ; d = gg ( d , a , b , c , k [ 2 ] , 9 , - 51403784 ) ; c = gg ( c , d , a , b , k [ 7 ] , 14 , 1735328473 ) ; b = gg ( b , c , d , a , k [ 12 ] , 20 , - 1926607734 ) ; a = hh ( a , b , c , d , k [ 5 ] , 4 , - 378558 ) ; d = hh ( d , a , b , c , k [ 8 ] , 11 , - 2022574463 ) ; c = hh ( c , d , a , b , k [ 11 ] , 16 , 1839030562 ) ; b = hh ( b , c , d , a , k [ 14 ] , 23 , - 35309556 ) ; a = hh ( a , b , c , d , k [ 1 ] , 4 , - 1530992060 ) ; d = hh ( d , a , b , c , k [ 4 ] , 11 , 1272893353 ) ; c = hh ( c , d , a , b , k [ 7 ] , 16 , - 155497632 ) ; b = hh ( b , c , d , a , k [ 10 ] , 23 , - 1094730640 ) ; a = hh ( a , b , c , d , k [ 13 ] , 4 , 681279174 ) ; d = hh ( d , a , b , c , k [ 0 ] , 11 , - 358537222 ) ; c = hh ( c , d , a , b , k [ 3 ] , 16 , - 722521979 ) ; b = hh ( b , c , d , a , k [ 6 ] , 23 , 76029189 ) ; a = hh ( a , b , c , d , k [ 9 ] , 4 , - 640364487 ) ; d = hh ( d , a , b , c , k [ 12 ] , 11 , - 421815835 ) ; c = hh ( c , d , a , b , k [ 15 ] , 16 , 530742520 ) ; b = hh ( b , c , d , a , k [ 2 ] , 23 , - 995338651 ) ; a = ii ( a , b , c , d , k [ 0 ] , 6 , - 198630844 ) ; d = ii ( d , a , b , c , k [ 7 ] , 10 , 1126891415 ) ; c = ii ( c , d , a , b , k [ 14 ] , 15 , - 1416354905 ) ; b = ii ( b , c , d , a , k [ 5 ] , 21 , - 57434055 ) ; a = ii ( a , b , c , d , k [ 12 ] , 6 , 1700485571 ) ; d = ii ( d , a , b , c , k [ 3 ] , 10 , - 1894986606 ) ; c = ii ( c , d , a , b , k [ 10 ] , 15 , - 1051523 ) ; b = ii ( b , c , d , a , k [ 1 ] , 21 , - 2054922799 ) ; a = ii ( a , b , c , d , k [ 8 ] , 6 , 1873313359 ) ; d = ii ( d , a , b , c , k [ 15 ] , 10 , - 30611744 ) ; c = ii ( c , d , a , b , k [ 6 ] , 15 , - 1560198380 ) ; b = ii ( b , c , d , a , k [ 13 ] , 21 , 1309151649 ) ; a = ii ( a , b , c , d , k [ 4 ] , 6 , - 145523070 ) ; d = ii ( d , a , b , c , k [ 11 ] , 10 , - 1120210379 ) ; c = ii ( c , d , a , b , k [ 2 ] , 15 , 718787259 ) ; b = ii ( b , c , d , a , k [ 9 ] , 21 , - 343485551 ) ; x [ 0 ] = add32 ( a , x [ 0 ] ) ; x [ 1 ] = add32 ( b , x [ 1 ] ) ; x [ 2 ] = add32 ( c , x [ 2 ] ) ; x [ 3 ] = add32 ( d , x [ 3 ] ) } function md5blk ( s ) { var md5blks = [ ] , i ; for ( i = 0 ; i < 64 ; i += 4 ) { md5blks [ i >> 2 ] = s . charCodeAt ( i ) + ( s . charCodeAt ( i + 1 ) << 8 ) + ( s . charCodeAt ( i + 2 ) << 16 ) + ( s . charCodeAt ( i + 3 ) << 24 ) } return md5blks } function md5blk _array ( a ) { var md5blks = [ ] , i ; for ( i = 0 ; i < 64 ; i += 4 ) { md5blks [ i >> 2 ] = a [ i ] + ( a [ i + 1 ] << 8 ) + ( a [ i + 2 ] << 16 ) + ( a [ i + 3 ] << 24 ) } return md5blks } function md51 ( s ) { var n = s . length , state = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] , i , length , tail , tmp , lo , hi ; for ( i = 64 ; i <= n ; i += 64 ) { md5cycle ( state , md5blk ( s . substring ( i - 64 , i ) ) ) } s = s . substring ( i - 64 ) ; length = s . length ; tail = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ; for ( i = 0 ; i < length ; i += 1 ) { tail [ i >> 2 ] |= s . charCodeAt ( i ) << ( i % 4 << 3 ) } tail [ i >> 2 ] |= 128 << ( i % 4 << 3 ) ; if ( i > 55 ) { md5cycle ( state , tail ) ; for ( i = 0 ; i < 16 ; i += 1 ) { tail [ i ] = 0 } } tmp = n * 8 ; tmp = tmp . toString ( 16 ) . match ( /(.*?)(.{0,8})$/ ) ; lo = parseInt ( tmp [ 2 ] , 16 ) ; hi = parseInt ( tmp [ 1 ] , 16 ) || 0 ; tail [ 14 ] = lo ; tail [ 15 ] = hi ; md5cycle ( state , tail ) ; return state } function md51 _array ( a ) { var n = a . length , state = [ 1732584193 , - 271733879 , - 1732584194 , 271733878 ] , i , length , tail , tmp , lo , hi ; for ( i = 64 ; i <= n ; i += 64 ) { md5cycle ( state , md5blk _array ( a . subarray ( i - 64 , i ) ) ) } a = i - 64 < n ? a . subarray ( i - 64 ) : new Uint8Array ( 0 ) ; length = a . length ; tail = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ; for ( i = 0 ; i < length ; i += 1 ) { tail [ i >