1 2/** 3 * @preserve jQuery DateTimePicker plugin v2.2.5 4 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ 5 * (c) 2014, Chupurnov Valeriy. 6 */ 7(function( $ ) { 8 'use strict' 9 var default_options = { 10 i18n:{ 11 ru:{ // Russian 12 months:[ 13 'ЯнваÑÑ','ФевÑалÑ','ÐаÑÑ','ÐпÑелÑ','Ðай','ÐÑнÑ','ÐÑлÑ','ÐвгÑÑÑ','СенÑÑбÑÑ','ÐкÑÑбÑÑ','ÐоÑбÑÑ','ÐекабÑÑ' 14 ], 15 dayOfWeek:[ 16 "ÐÑк", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 17 ] 18 }, 19 en:{ // English 20 months: [ 21 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" 22 ], 23 dayOfWeek: [ 24 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 25 ] 26 }, 27 de:{ // German 28 months:[ 29 'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember' 30 ], 31 dayOfWeek:[ 32 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" 33 ] 34 }, 35 nl:{ // Dutch 36 months:[ 37 "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" 38 ], 39 dayOfWeek:[ 40 "zo", "ma", "di", "wo", "do", "vr", "za" 41 ] 42 }, 43 tr:{ // Turkish 44 months:[ 45 "Ocak", "Åubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "AÄustos", "Eylül", "Ekim", "Kasım", "Aralık" 46 ], 47 dayOfWeek:[ 48 "Paz", "Pts", "Sal", "Ãar", "Per", "Cum", "Cts" 49 ] 50 }, 51 fr:{ //French 52 months:[ 53 "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" 54 ], 55 dayOfWeek:[ 56 "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" 57 ] 58 }, 59 es:{ // Spanish 60 months: [ 61 "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" 62 ], 63 dayOfWeek: [ 64 "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" 65 ] 66 }, 67 th:{ // Thai 68 months:[ 69 'มà¸à¸£à¸²à¸à¸¡','à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹','มีà¸à¸²à¸à¸¡','à¹à¸¡à¸©à¸²à¸¢à¸','à¸à¸¤à¸©à¸ าà¸à¸¡','มิà¸à¸¸à¸à¸²à¸¢à¸','à¸à¸£à¸à¸à¸²à¸à¸¡','สิà¸à¸«à¸²à¸à¸¡','à¸à¸±à¸à¸¢à¸²à¸¢à¸','à¸à¸¸à¸¥à¸²à¸à¸¡','à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸','à¸à¸±à¸à¸§à¸²à¸à¸¡' 70 ], 71 dayOfWeek:[ 72 'à¸à¸².','à¸.','à¸.','à¸.','à¸à¸¤.','ศ.','ส.' 73 ] 74 }, 75 pl:{ // Polish 76 months: [ 77 "styczeÅ", "luty", "marzec", "kwiecieÅ", "maj", "czerwiec", "lipiec", "sierpieÅ", "wrzesieÅ", "październik", "listopad", "grudzieÅ" 78 ], 79 dayOfWeek: [ 80 "nd", "pn", "wt", "År", "cz", "pt", "sb" 81 ] 82 }, 83 pt:{ // Portuguese 84 months: [ 85 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 86 ], 87 dayOfWeek: [ 88 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" 89 ] 90 }, 91 ch:{ // Simplified Chinese 92 months: [ 93 "䏿","äºæ","䏿","åæ","äºæ","å æ","䏿","å «æ","乿","åæ","å䏿","åäºæ" 94 ], 95 dayOfWeek: [ 96 "æ¥", "ä¸","äº","ä¸","å","äº","å " 97 ] 98 }, 99 se:{ // Swedish 100 months: [ 101 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September","Oktober", "November", "December" 102 ], 103 dayOfWeek: [ 104 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 105 ] 106 }, 107 kr:{ // Korean 108 months: [ 109 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 110 ], 111 dayOfWeek: [ 112 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 113 ] 114 }, 115 it:{ // Italian 116 months: [ 117 "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" 118 ], 119 dayOfWeek: [ 120 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" 121 ] 122 }, 123 da:{ // Dansk 124 months: [ 125 "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" 126 ], 127 dayOfWeek: [ 128 "Søn", "Man", "Tir", "ons", "Tor", "Fre", "lør" 129 ] 130 }, 131 ja:{ // Japanese 132 months: [ 133 "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ" 134 ], 135 dayOfWeek: [ 136 "æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å" 137 ] 138 }, 139 vi:{ // Vietnamese 140 months: [ 141 "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" 142 ], 143 dayOfWeek: [ 144 "CN", "T2", "T3", "T4", "T5", "T6", "T7" 145 ] 146 }, 147 }, 148 value:'', 149 lang: 'en', 150 151 format: 'Y/m/d H:i', 152 formatTime: 'H:i', 153 formatDate: 'Y/m/d', 154 155 startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 156 157 //fromUnixtime: false, 158 159 step:60, 160 161 closeOnDateSelect:false, 162 closeOnWithoutClick:true, 163 164 timepicker:true, 165 datepicker:true, 166 167 minDate:false, 168 maxDate:false, 169 minTime:false, 170 maxTime:false, 171 172 allowTimes:[], 173 opened:false, 174 initTime:true, 175 inline:false, 176 177 onSelectDate:function() {}, 178 onSelectTime:function() {}, 179 onChangeMonth:function() {}, 180 onChangeDateTime:function() {}, 181 onShow:function() {}, 182 onClose:function() {}, 183 onGenerate:function() {}, 184 185 withoutCopyright:true, 186 187 inverseButton:false, 188 hours12:false, 189 next: 'xdsoft_next', 190 prev : 'xdsoft_prev', 191 dayOfWeekStart:0, 192 193 timeHeightInTimePicker:25, 194 timepickerScrollbar:true, 195 196 todayButton:true, // 2.1.0 197 defaultSelect:true, // 2.1.0 198 199 scrollMonth:true, 200 scrollTime:true, 201 scrollInput:true, 202 203 lazyInit:false, 204 205 mask:false, 206 validateOnBlur:true, 207 allowBlank:true, 208 209 yearStart:1950, 210 yearEnd:2050, 211 212 style:'', 213 id:'', 214 215 roundTime:'round', // ceil, floor 216 className:'', 217 218 weekends : [], 219 yearOffset:0 220 }; 221 222 // fix for ie8 223 if ( !Array.prototype.indexOf ) { 224 Array.prototype.indexOf = function(obj, start) { 225 for (var i = (start || 0), j = this.length; i < j; i++) { 226 if (this[i] === obj) { return i; } 227 } 228 return -1; 229 } 230 }; 231 232 $.fn.xdsoftScroller = function( _percent ) { 233 return this.each(function() { 234 var timeboxparent = $(this); 235 if( !$(this).hasClass('xdsoft_scroller_box') ) { 236 var pointerEventToXY = function( e ) { 237 var out = {x:0, y:0}; 238 if( e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel' ) { 239 var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 240 out.x = touch.pageX; 241 out.y = touch.pageY; 242 }else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover'|| e.type=='mouseout' || e.type=='mouseenter' || e.type=='mouseleave') { 243 out.x = e.pageX; 244 out.y = e.pageY; 245 } 246 return out; 247 }, 248 move = 0, 249 timebox = timeboxparent.children().eq(0), 250 parentHeight = timeboxparent[0].clientHeight, 251 height = timebox[0].offsetHeight, 252 scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
253 scroller = $('<div class="xdsoft_scroller"></div>'), 254 maximumOffset = 100, 255 start = false; 256 257 scrollbar.append(scroller); 258 259 timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); 260 scroller.on('mousedown.xdsoft_scroller',function ( event ) { 261 if( !parentHeight ) 262 timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]); 263 var pageY = event.pageY, 264 top = parseInt(scroller.css('margin-top')), 265 h1 = scrollbar[0].offsetHeight; 266 $(document.body).addClass('xdsoft_noselect'); 267 $([document.body,window]).on('mouseup.xdsoft_scroller',function arguments_callee() { 268 $([document.body,window]).off('mouseup.xdsoft_scroller',arguments_callee) 269 .off('mousemove.xdsoft_scroller',move) 270 .removeClass('xdsoft_noselect'); 271 }); 272 $(document.body).on('mousemove.xdsoft_scroller',move = function(event) { 273 var offset = event.pageY-pageY+top; 274 if( offset<0 ) 275 offset = 0; 276 if( offset+scroller[0].offsetHeight>h1 ) 277 offset = h1-scroller[0].offsetHeight; 278 timeboxparent.trigger('scroll_element.xdsoft_scroller',[maximumOffset?offset/maximumOffset:0]); 279 }); 280 }); 281 282 timeboxparent 283 .on('scroll_element.xdsoft_scroller',function( event,percent ) { 284 if( !parentHeight ) 285 timeboxparent.trigger('resize_scroll.xdsoft_scroller',[percent,true]); 286 percent = percent>1?1:(percent<0||isNaN(percent))?0:percent; 287 scroller.css('margin-top',maximumOffset*percent); 288 timebox.css('marginTop',-parseInt((height-parentHeight)*percent)) 289 }) 290 .on('resize_scroll.xdsoft_scroller',function( event,_percent,noTriggerScroll ) { 291 parentHeight = timeboxparent[0].clientHeight; 292 height = timebox[0].offsetHeight; 293 var percent = parentHeight/height, 294 sh = percent*scrollbar[0].offsetHeight; 295 if( percent>1 ) 296 scroller.hide(); 297 else{ 298 scroller.show(); 299 scroller.css('height',parseInt(sh>10?sh:10)); 300 maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight; 301 if( noTriggerScroll!==true ) 302 timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]); 303 } 304 }); 305 timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) { 306 var top = Math.abs(parseInt(timebox.css('marginTop'))); 307 timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-delta*20)/(height-parentHeight)]); 308 event.stopPropagation(); 309 return false; 310 }); 311 timeboxparent.on('touchstart',function( event ) { 312 start = pointerEventToXY(event); 313 }); 314 timeboxparent.on('touchmove',function( event ) { 315 if( start ) { 316 var coord = pointerEventToXY(event), top = Math.abs(parseInt(timebox.css('marginTop'))); 317 timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-(coord.y-start.y))/(height-parentHeight)]); 318 event.stopPropagation(); 319 event.preventDefault(); 320 }; 321 }); 322 timeboxparent.on('touchend touchcancel',function( event ) { 323 start = false;
324 }); 325 } 326 timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]); 327 }); 328 }; 329 $.fn.datetimepicker = function( opt ) { 330 var KEY0 = 48, 331 KEY9 = 57, 332 _KEY0 = 96, 333 _KEY9 = 105, 334 CTRLKEY = 17, 335 DEL = 46, 336 ENTER = 13, 337 ESC = 27, 338 BACKSPACE = 8, 339 ARROWLEFT = 37, 340 ARROWUP = 38, 341 ARROWRIGHT = 39, 342 ARROWDOWN = 40, 343 TAB = 9, 344 F5 = 116, 345 AKEY = 65, 346 CKEY = 67, 347 VKEY = 86, 348 ZKEY = 90, 349 YKEY = 89, 350 ctrlDown = false, 351 options = ($.isPlainObject(opt)||!opt)?$.extend(true,{},default_options,opt):$.extend({},default_options), 352 353 lazyInitTimer = 0, 354 355 lazyInit = function( input ){ 356 input 357 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function initOnActionCallback(event) { 358 if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||input.data( 'xdsoft_datetimepicker') ) 359 return; 360 361 clearTimeout(lazyInitTimer); 362 363 lazyInitTimer = setTimeout(function() { 364 365 if( !input.data( 'xdsoft_datetimepicker') ) 366 createDateTimePicker(input); 367 368 input 369 .off('open.xdsoft focusin.xdsoft mousedown.xdsoft',initOnActionCallback) 370 .trigger('open.xdsoft'); 371 },100); 372 373 }); 374 }, 375 376 createDateTimePicker = function( input ) { 377 378 var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+options.className+'"></div>'), 379 xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), 380 datepicker = $('<div class="xdsoft_datepicker active"></div>'), 381 mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month"><span></span></div><div class="xdsoft_label xdsoft_year"><span></span></div><button type="button" class="xdsoft_next"></button></div>'), 382 calendar = $('<div class="xdsoft_calendar"></div>'), 383 timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'), 384 timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), 385 timebox = $('<div class="xdsoft_time_variant"></div>'), 386 scrollbar = $('<div class="xdsoft_scrollbar"></div>'), 387 scroller = $('<div class="xdsoft_scroller"></div>'), 388 monthselect =$('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), 389 yearselect =$('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'); 390 391 //constructor lego 392 mounth_picker 393 .find('.xdsoft_month span') 394 .after(monthselect); 395 mounth_picker 396 .find('.xdsoft_year span') 397 .after(yearselect); 398 399 mounth_picker 400 .find('.xdsoft_month,.xdsoft_year') 401 .on('mousedown.xdsoft',function(event) { 402 mounth_picker 403 .find('.xdsoft_select') 404 .hide(); 405 406 var select = $(this).find('.xdsoft_select').eq(0), 407 val = 0, 408 top = 0; 409 410 if( _xdsoft_datetime.currentTime ) 411 val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear'](); 412 413 select.show(); 414 415 for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) { 416 if( items.eq(i).data('value')==val ) { 417 break; 418 }else top+=items[0].offsetHeight; 419 } 420
421 select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight))); 422 event.stopPropagation(); 423 424 return false; 425 }); 426 427 mounth_picker 428 .find('.xdsoft_select') 429 .xdsoftScroller() 430 .on('mousedown.xdsoft',function( event ) { 431 event.stopPropagation(); 432 event.preventDefault(); 433 }) 434 .on('mousedown.xdsoft','.xdsoft_option',function( event ) { 435 if( _xdsoft_datetime&&_xdsoft_datetime.currentTime ) 436 _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value')); 437 438 $(this).parent().parent().hide(); 439 440 datetimepicker.trigger('xchange.xdsoft'); 441 options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 442 }); 443 444 445 // set options 446 datetimepicker.setOptions = function( _options ) { 447 options = $.extend(true,{},options,_options); 448 449 if( _options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length ){ 450 options['allowTimes'] = $.extend(true,[],_options.allowTimes); 451 } 452 453 if( _options.weekends && $.isArray(_options.weekends) && _options.weekends.length ){ 454 options['weekends'] = $.extend(true,[],_options.weekends); 455 } 456 457 if( (options.open||options.opened)&&(!options.inline) ) { 458 input.trigger('open.xdsoft'); 459 } 460 461 if( options.inline ) { 462 datetimepicker.addClass('xdsoft_inline'); 463 input.after(datetimepicker).hide(); 464 datetimepicker.trigger('afterOpen.xdsoft'); 465 } 466 467 if( options.inverseButton ) { 468 options.next = 'xdsoft_prev'; 469 options.prev = 'xdsoft_next'; 470 } 471 472 if( options.datepicker ) 473 datepicker.addClass('active'); 474 else 475 datepicker.removeClass('active'); 476 477 if( options.timepicker ) 478 timepicker.addClass('active'); 479 else 480 timepicker.removeClass('active'); 481 482 if( options.value ){ 483 input&&input.val&&input.val(options.value); 484 _xdsoft_datetime.setCurrentTime(options.value); 485 } 486 487 if( isNaN(options.dayOfWeekStart)||parseInt(options.dayOfWeekStart)<0||parseInt(options.dayOfWeekStart)>6 ) 488 options.dayOfWeekStart = 0; 489 else 490 options.dayOfWeekStart = parseInt(options.dayOfWeekStart); 491 492 if( !options.timepickerScrollbar ) 493 scrollbar.hide(); 494
495 if( options.minDate && /^-(.*)$/.test(options.minDate) ){ 496 options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat( options.formatDate ); 497 } 498 499 if( options.maxDate && /^\+(.*)$/.test(options.maxDate) ) { 500 options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat( options.formatDate ); 501 } 502 503 mounth_picker 504 .find('.xdsoft_today_button') 505 .css('visibility',!options.todayButton?'hidden':'visible'); 506 507 if( options.mask ) { 508 var e, 509 getCaretPos = function ( input ) { 510 try{ 511 if ( document.selection && document.selection.createRange ) { 512 var range = document.selection.createRange(); 513 return range.getBookmark().charCodeAt(2) - 2; 514 }else 515 if ( input.setSelectionRange ) 516 return input.selectionStart; 517 }catch(e) { 518 return 0; 519 } 520 }, 521 setCaretPos = function ( node,pos ) { 522 var node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node; 523 if(!node) { 524 return false; 525 }else if(node.createTextRange) { 526 var textRange = node.createTextRange(); 527 textRange.collapse(true); 528 textRange.moveEnd(pos); 529 textRange.moveStart(pos); 530 textRange.select(); 531 return true; 532 }else if(node.setSelectionRange) { 533 node.setSelectionRange(pos,pos); 534 return true; 535 } 536 return false; 537 }, 538 isValidValue = function ( mask,value ) { 539 var reg = mask 540 .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,'\\$1') 541 .replace(/_/g,'{digit+}') 542 .replace(/([0-9]{1})/g,'{digit$1}') 543 .replace(/\{digit([0-9]{1})\}/g,'[0-$1_]{1}') 544 .replace(/\{digit[\+]\}/g,'[0-9_]{1}'); 545 return RegExp(reg).test(value); 546 }; 547 input.off('keydown.xdsoft'); 548 switch(true) { 549 case ( options.mask===true ): 550 551 options.mask = options.format 552 .replace(/Y/g,'9999') 553 .replace(/F/g,'9999') 554 .replace(/m/g,'19') 555 .replace(/d/g,'39') 556 .replace(/H/g,'29') 557 .replace(/i/g,'59') 558 .replace(/s/g,'59'); 559 560 case ( $.type(options.mask) == 'string' ): 561 562 if( !isValidValue( options.mask,input.val() ) ) 563 input.val(options.mask.replace(/[0-9]/g,'_')); 564 565 input.on('keydown.xdsoft',function( event ) { 566 var val = this.value, 567 key = event.which; 568 569 switch(true) { 570 case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL): 571 var pos = getCaretPos(this), 572 digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode((_KEY0 <= key && key <= _KEY9)? key-KEY0 : key):'_'; 573 574 if( (key==BACKSPACE||key==DEL)&&pos ) { 575 pos--; 576 digit='_'; 577 } 578 579 while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 ) 580 pos+=( key==BACKSPACE||key==DEL )?-1:1; 581 582 val = val.substr(0,pos)+digit+val.substr(pos+1); 583 if( $.trim(val)=='' ){ 584 val = options.mask.replace(/[0-9]/g,'_'); 585 }else{ 586 if( pos==options.mask.length ) 587 break; 588 } 589 590 pos+=(key==BACKSPACE||key==DEL)?0:1; 591 while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 ) 592 pos+=(key==BACKSPACE||key==DEL)?-1:1; 593 594 if( isValidValue( options.mask,val ) ) { 595 this.value = val; 596 setCaretPos(this,pos); 597 }else if( $.trim(val)=='' ) 598 this.value = options.mask.replace(/[0-9]/g,'_'); 599 else{ 600 input.trigger('error_input.xdsoft'); 601 } 602 break; 603 case ( !!~([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key))&&ctrlDown ): 604 case !!~([ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,
604CTRLKEY,TAB,ENTER].indexOf(key)): 605 return true; 606 } 607 event.preventDefault(); 608 return false; 609 }); 610 break; 611 } 612 } 613 if( options.validateOnBlur ) { 614 input 615 .off('blur.xdsoft') 616 .on('blur.xdsoft', function() { 617 if( options.allowBlank && !$.trim($(this).val()).length ) { 618 $(this).val(null); 619 datetimepicker.data('xdsoft_datetime').empty(); 620 }else if( !Date.parseDate( $(this).val(), options.format ) ) { 621 $(this).val((_xdsoft_datetime.now()).dateFormat( options.format )); 622 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 623 } 624 else{ 625 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 626 } 627 datetimepicker.trigger('changedatetime.xdsoft'); 628 }); 629 } 630 options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1; 631 datetimepicker 632 .trigger('xchange.xdsoft'); 633 }; 634 635 datetimepicker 636 .data('options',options) 637 .on('mousedown.xdsoft',function( event ) { 638 event.stopPropagation(); 639 event.preventDefault(); 640 yearselect.hide(); 641 monthselect.hide(); 642 return false; 643 }); 644 645 var scroll_element = timepicker.find('.xdsoft_time_box'); 646 scroll_element.append(timebox); 647 scroll_element.xdsoftScroller(); 648 datetimepicker.on('afterOpen.xdsoft',function() { 649 scroll_element.xdsoftScroller(); 650 }); 651 652 datetimepicker 653 .append(datepicker) 654 .append(timepicker); 655 656 if( options.withoutCopyright!==true ) 657 datetimepicker 658 .append(xdsoft_copyright); 659 660 datepicker 661 .append(mounth_picker) 662 .append(calendar); 663 664 $('body').append(datetimepicker); 665 666 var _xdsoft_datetime = new function() { 667 var _this = this; 668 _this.now = function() { 669 var d = new Date(); 670 if( options.yearOffset ) 671 d.setFullYear(d.getFullYear()+options.yearOffset); 672 return d; 673 }; 674 675 _this.currentTime = this.now(); 676 _this.isValidDate = function (d) { 677 if ( Object.prototype.toString.call(d) !== "[object Date]" ) 678 return false; 679 return !isNaN(d.getTime()); 680 }; 681 682 _this.setCurrentTime = function( dTime) { 683 _this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now(); 684 datetimepicker.trigger('xchange.xdsoft'); 685 }; 686 687 _this.empty = function() { 688 _this.currentTime = null; 689 }; 690 691 _this.getCurrentTime = function( dTime) { 692 return _this.currentTime; 693 }; 694 695 _this.nextMonth = function() { 696 var month = _this.currentTime.getMonth()+1; 697 if( month==12 ) { 698 _this.currentTime.setFullYear(_this.currentTime.getFullYear()+1); 699 month = 0; 700 } 701 _this.currentTime.setDate( 702 Math.min( 703 Date.daysInMonth[month], 704 _this.currentTime.getDate() 705 ) 706 ) 707 _this.currentTime.setMonth(month); 708 options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 709 datetimepicker.trigger('xchange.xdsoft'); 710 return month; 711 }; 712 713 _this.prevMonth = function() { 714 var month = _this.currentTime.getMonth()-1; 715 if( month==-1 ) { 716 _this.currentTime.setFullYear(_this.currentTime.getFullYear()-1); 717 month = 11; 718 } 719 _this.currentTime.setDate( 720 Math.min( 721 Date.daysInMonth[month], 722 _this.currentTime.getDate() 723 ) 724 ) 725 _this.currentTime.setMonth(month); 726 options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 727 datetimepicker.trigger('xchange.xdsoft'); 728 return month; 729 }; 730 731 _this.strToDateTime = function( sDateTime ) { 732 var tmpDate = [],timeOffset,currentTime; 733 734 if( ( tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime) ) && ( tmpDate[2]=Date.parseDate(tmpDate[2], options.formatDate) ) ) { 735 timeOffset = tmpDate[2].getTime()-1*(tmpDate[2].getTimezoneOffset())*60000; 736 currentTime = new Date((_xdsoft_datetime.now()).getTime()+parseInt(tmpDate[1]+'1')*timeOffset); 737 }else 738 currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now(); 739 740 if( !_this.isValidDate(currentTime) ) 741 currentTime = _this.now(); 742 743 return currentTime; 744 }; 745 746 _this.strtodate = function( sDate ) { 747 var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now(); 748 if( !_this.isValidDate(currentTime) ) 749 currentTime = _this.now(); 750 return currentTime; 751 }; 752 753 _this.strtotime = function( sTime ) { 754 var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now(); 755 if( !_this.isValidDate(currentTime) ) 756 currentTime = _this.now(); 757 return currentTime; 758 }; 759 760 _this.str = function() { 761 return _this.currentTime.dateFormat(options.format); 762 }; 763 }; 764 mounth_picker 765 .find('.xdsoft_today_button') 766 .on('mousedown.xdsoft',function() { 767 datetimepicker.data('changed',true); 768 _xdsoft_datetime.setCurrentTime(0); 769 datetimepicker.trigger('afterOpen.xdsoft'); 770 }).on('dblclick.xdsoft',function(){ 771 input.val( _xdsoft_datetime.str() ); 772 datetimepicker.trigger('close.xdsoft'); 773 }); 774 mounth_picker 775 .find('.xdsoft_prev,.xdsoft_next') 776 .on('mousedown.xdsoft',function() { 777 var $this = $(this), 778 timer = 0, 779 stop = false;
780 781 (function arguments_callee1(v) { 782 var month = _xdsoft_datetime.currentTime.getMonth(); 783 if( $this.hasClass( options.next ) ) { 784 _xdsoft_datetime.nextMonth(); 785 }else if( $this.hasClass( options.prev ) ) { 786 _xdsoft_datetime.prevMonth(); 787 } 788 !stop&&(timer = setTimeout(arguments_callee1,v?v:100)); 789 })(500); 790 791 $([document.body,window]).on('mouseup.xdsoft',function arguments_callee2() { 792 clearTimeout(timer); 793 stop = true; 794 $([document.body,window]).off('mouseup.xdsoft',arguments_callee2); 795 }); 796 }); 797 798 timepicker 799 .find('.xdsoft_prev,.xdsoft_next') 800 .on('mousedown.xdsoft',function() { 801 var $this = $(this), 802 timer = 0, 803 stop = false, 804 period = 110; 805 (function arguments_callee4(v) { 806 var pheight = timeboxparent[0].clientHeight, 807 height = timebox[0].offsetHeight, 808 top = Math.abs(parseInt(timebox.css('marginTop'))); 809 if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) { 810 timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px') 811 }else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0 ) { 812 timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px') 813 } 814 timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]); 815 period= ( period>10 )?10:period-10; 816 !stop&&(timer = setTimeout(arguments_callee4,v?v:period)); 817 })(500); 818 $([document.body,window]).on('mouseup.xdsoft',function arguments_callee5() { 819 clearTimeout(timer); 820 stop = true; 821 $([document.body,window]) 822 .off('mouseup.xdsoft',arguments_callee5); 823 }); 824 }); 825 826 var xchangeTimer = 0; 827 // base handler - generating a calendar and timepicker 828 datetimepicker 829 .on('xchange.xdsoft',function( event ) { 830 clearTimeout(xchangeTimer); 831 xchangeTimer = setTimeout(function(){ 832 var table = '', 833 start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1, 12, 0, 0), 834 i = 0, 835 today = _xdsoft_datetime.now(); 836 837 while( start.getDay()!=options.dayOfWeekStart ) 838 start.setDate(start.getDate()-1); 839 840 //generate calendar 841 table+='<table><thead><tr>'; 842 843 // days 844 for(var j = 0; j<7; j++) { 845 table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>'; 846 } 847 848 table+='</tr></thead>'; 849 table+='<tbody><tr>'; 850 var maxDate = false, minDate = false; 851 852 if( options.maxDate!==false ) { 853 maxDate = _xdsoft_datetime.strtodate(options.maxDate); 854 maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999); 855 } 856 857 if( options.minDate!==false ) { 858 minDate = _xdsoft_datetime.strtodate(options.minDate); 859 minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate()); 860 } 861 862 var d,y,m,classes = []; 863 864 while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) { 865 classes = []; 866 i++; 867 868 d = start.getDate(); y = start.getFullYear(); m = start.getMonth(); 869 870 classes.push('xdsoft_date'); 871 872 if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){ 873 classes.push('xdsoft_disabled'); 874 } 875 876 if( _xdsoft_datetime.currentTime.getMonth()!=m ){ 877 classes.push('xdsoft_other_month'); 878 } 879 880 if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) { 881 classes.push('xdsoft_current'); 882 } 883 884 if( today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) { 885 classes.push('xdsoft_today'); 886 } 887 888 if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat('d.m.Y')) ) { 889 classes.push('xdsoft_weekend'); 890 } 891 892 if(options.beforeShowDay && typeof options.beforeShowDay == 'function') 893 { 894 classes.push(options.beforeShowDay(start)) 895 } 896 897 table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date xdsoft_day_of_week'+start.getDay()+' '+ classes.join(' ')+'">'+ 898 '<div>'+d+'</div>'+ 899 '</td>'; 900 901 if( start.getDay()==options.dayOfWeekStartPrev ) { 902 table+='</tr>'; 903 } 904 905 start.setDate(d+1); 906 } 907 table+='</tbody></table>'; 908 909 calendar.html(table); 910 911 mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]); 912 mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); 913 914 // generate timebox 915 var time = '', 916 h = '', 917 m ='', 918 line_time = function line_time( h,m ) { 919 var now = _xdsoft_datetime.now(); 920 now.setHours(h); 921 h = parseInt(now.getHours()); 922 now.setMinutes(m); 923 m = parseInt(now.getMinutes()); 924 925 classes = []; 926 if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime())) 927 classes.push('xdsoft_disabled'); 928 if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) { 929 if( options.defaultSelect||datetimepicker.data('changed')) { 930 classes.push('xdsoft_current'); 931 } else if( options.initTime ) { 932 classes.push('xdsoft_init_time'); 933 } 934 } 935 if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m)) 936 classes.push('xdsoft_today'); 937 time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>'; 938 }; 939 940 if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) { 941 for( var i=0,j=0;i<(options.hours12?12:24);i++ ) { 942 for( j=0;j<60;j+=options.step ) { 943 h = (i<10?'0':'')+i; 944 m = (j<10?'0':'')+j; 945 line_time( h,m ); 946 } 947 } 948 }else{ 949 for( var i=0;i<options.allowTimes.length;i++ ) { 950 h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); 951 m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); 952 line_time( h,m ); 953 } 954 } 955 956 timebox.html(time); 957 958 var opt = '', 959 i = 0; 960 961 for( i = parseInt(options.yearStart,10)+options.yearOffset;i<= parseInt(options.yearEnd,10)+options.yearOffset;i++ ) { 962 opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>'; 963 } 964 yearselect.children().eq(0) 965 .html(opt); 966 967 for( i = 0,opt = '';i<= 11;i++ ) { 968 opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>'; 969 } 970 monthselect.children().eq(0).html(opt); 971 $(this).trigger('generate.xdsoft'); 972 },10); 973 event.stopPropagation(); 974 }) 975 .on('afterOpen.xdsoft',function() { 976 if( options.timepicker ) { 977 var classType; 978 if( timebox.find('.xdsoft_current').length ) { 979 classType = '.xdsoft_current'; 980 } else if( timebox.find('.xdsoft_init_time').length ) { 981 classType = '.xdsoft_init_time'; 982 } 983 984 if( classType ) { 985 var pheight = timeboxparent[0].clientHeight, 986 height = timebox[0].offsetHeight, 987 top = timebox.find(classType).index()*options.timeHeightInTimePicker+1; 988 if( (height-pheight)<top ) 989 top = height-pheight; 990 timebox.css('marginTop','-'+parseInt(top)+'px'); 991 timeboxparent.trigger('scroll_element.xdsoft_scroller',[parseInt(top)/(height-pheight)]); 992 } 993 } 994 }); 995 996 var timerclick = 0; 997 998 calendar 999 .on('click.xdsoft', 'td', function (xdevent) { 1000 xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap 1001 timerclick++; 1002 var $this = $(this), 1003 currentTime = _xdsoft_datetime.currentTime; 1004 if( $this.hasClass('xdsoft_disabled') ) 1005 return false;
1006 1007 currentTime.setDate( $this.data('date') ); 1008 currentTime.setMonth( $this.data('month') ); 1009 currentTime.setFullYear( $this.data('year') ); 1010 1011 datetimepicker.trigger('select.xdsoft',[currentTime]); 1012 1013 input.val( _xdsoft_datetime.str() ); 1014 if( (timerclick>1||(options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker )))&&!options.inline ) { 1015 datetimepicker.trigger('close.xdsoft'); 1016 } 1017 1018 if( options.onSelectDate && options.onSelectDate.call ) { 1019 options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 1020 } 1021 1022 datetimepicker.data('changed',true); 1023 datetimepicker.trigger('xchange.xdsoft'); 1024 datetimepicker.trigger('changedatetime.xdsoft'); 1025 setTimeout(function(){ 1026 timerclick = 0; 1027 },200); 1028 }); 1029 1030 timebox 1031 .on('click.xdsoft', 'div', function (xdevent) { 1032 xdevent.stopPropagation(); // NAJ: Prevents closing of Pop-ups, Modals and Flyouts 1033 var $this = $(this), 1034 currentTime = _xdsoft_datetime.currentTime; 1035 if( $this.hasClass('xdsoft_disabled') ) 1036 return false; 1037 currentTime.setHours($this.data('hour')); 1038 currentTime.setMinutes($this.data('minute')); 1039 datetimepicker.trigger('select.xdsoft',[currentTime]); 1040 1041 datetimepicker.data('input').val( _xdsoft_datetime.str() ); 1042 1043 !options.inline&&datetimepicker.trigger('close.xdsoft'); 1044 1045 if( options.onSelectTime&&options.onSelectTime.call ) { 1046 options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 1047 } 1048 datetimepicker.data('changed',true); 1049 datetimepicker.trigger('xchange.xdsoft'); 1050 datetimepicker.trigger('changedatetime.xdsoft'); 1051 }); 1052 1053 datetimepicker.mousewheel&&datepicker.mousewheel(function(event, delta, deltaX, deltaY) { 1054 if( !options.scrollMonth ) 1055 return true; 1056 if( delta<0 ) 1057 _xdsoft_datetime.nextMonth(); 1058 else 1059 _xdsoft_datetime.prevMonth(); 1060 return false; 1061 }); 1062 1063 datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) { 1064 if( !options.scrollTime ) 1065 return true; 1066 var pheight = timeboxparent[0].clientHeight, 1067 height = timebox[0].offsetHeight, 1068 top = Math.abs(parseInt(timebox.css('marginTop'))), 1069 fl = true; 1070 if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ) { 1071 timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px'); 1072 fl = false; 1073 }else if( delta>0&&top-options.timeHeightInTimePicker>=0 ) { 1074 timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px'); 1075 fl = false; 1076 } 1077 timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]); 1078 event.stopPropagation(); 1079 return fl; 1080 }); 1081 1082 datetimepicker 1083 .on('changedatetime.xdsoft',function() { 1084 if( options.onChangeDateTime&&options.onChangeDateTime.call ) { 1085 var $input = datetimepicker.data('input'); 1086 options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input); 1087 $input.trigger('change'); 1088 } 1089 }) 1090 .on('generate.xdsoft',function() { 1091 if( options.onGenerate&&options.onGenerate.call ) 1092 options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 1093 }); 1094 1095 var current_time_index = 0; 1096 input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ) { 1097 if( !options.scrollInput ) 1098 return true; 1099 if( !options.datepicker && options.timepicker ) { 1100 current_time_index = timebox.find('.xdsoft_current').length?timebox.find('.xdsoft_current').eq(0).index():0; 1101 if( current_time_index+delta>=0&¤t_time_index+delta<timebox.children().length ) 1102 current_time_index+=delta; 1103 timebox.children().eq(current_time_index).length&&timebox.children().eq(current_time_index).trigger('mousedown'); 1104 return false; 1105 }else if( options.datepicker && !options.timepicker ) { 1106 datepicker.trigger( event, [delta, deltaX, deltaY]); 1107 input.val&&input.val( _xdsoft_datetime.str() ); 1108 datetimepicker.trigger('changedatetime.xdsoft'); 1109 return false;
1110 } 1111 }); 1112 var setPos = function() { 1113 var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left; 1114 if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() ) 1115 top = offset.top-datetimepicker[0].offsetHeight+1; 1116 if (top < 0) 1117 top = 0; 1118 if( left+datetimepicker[0].offsetWidth>$(window).width() ) 1119 left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth; 1120 datetimepicker.css({ 1121 left:left, 1122 top:top 1123 }); 1124 }; 1125 datetimepicker 1126 .on('open.xdsoft', function() { 1127 var onShow = true; 1128 if( options.onShow&&options.onShow.call) { 1129 onShow = options.onShow.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 1130 } 1131 if( onShow!==false ) { 1132 datetimepicker.show(); 1133 datetimepicker.trigger('afterOpen.xdsoft'); 1134 setPos(); 1135 $(window) 1136 .off('resize.xdsoft',setPos) 1137 .on('resize.xdsoft',setPos); 1138 1139 if( options.closeOnWithoutClick ) { 1140 $([document.body,window]).on('mousedown.xdsoft',function arguments_callee6() { 1141 datetimepicker.trigger('close.xdsoft'); 1142 $([document.body,window]).off('mousedown.xdsoft',arguments_callee6); 1143 }); 1144 } 1145 } 1146 }) 1147 .on('close.xdsoft', function( event ) { 1148 var onClose = true; 1149 if( options.onClose&&options.onClose.call ) { 1150 onClose=options.onClose.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input')); 1151 } 1152 if( onClose!==false&&!options.opened&&!options.inline ) { 1153 datetimepicker.hide(); 1154 } 1155 event.stopPropagation(); 1156 }) 1157 .data('input',input); 1158 1159 var timer = 0, 1160 timer1 = 0; 1161 1162 datetimepicker.data('xdsoft_datetime',_xdsoft_datetime); 1163 datetimepicker.setOptions(options); 1164 1165 function getCurrentValue(){ 1166 var ct = options.value?options.value:(input&&input.val&&input.val())?input.val():''; 1167 1168 if( ct && _xdsoft_datetime.isValidDate(ct = Date.parseDate(ct, options.format)) ) { 1169 datetimepicker.data('changed',true); 1170 }else 1171 ct = ''; 1172 1173 if( !ct && options.startDate!==false ){ 1174 ct = _xdsoft_datetime.strToDateTime(options.startDate); 1175 } 1176 1177 return ct?ct:0; 1178 } 1179 1180 _xdsoft_datetime.setCurrentTime( getCurrentValue() ); 1181 1182 datetimepicker.trigger('afterOpen.xdsoft'); 1183 1184 input 1185 .data( 'xdsoft_datetimepicker',datetimepicker ) 1186 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event) { 1187 if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') ) 1188 return; 1189 clearTimeout(timer); 1190 timer = setTimeout(function() { 1191 if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') ) 1192 return; 1193 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 1194 1195 datetimepicker.trigger('open.xdsoft'); 1196 },100); 1197 }) 1198 .on('keydown.xdsoft',function( event ) { 1199 var val = this.value, 1200 key = event.which; 1201 switch(true) { 1202 case !!~([ENTER].indexOf(key)): 1203 var elementSelector = $("input:visible,textarea:visible"); 1204 datetimepicker.trigger('close.xdsoft'); 1205 elementSelector.eq(elementSelector.index(this) + 1).focus(); 1206 return false; 1207 case !!~[TAB].indexOf(key): 1208 datetimepicker.trigger('close.xdsoft'); 1209 return true; 1210 } 1211 }); 1212 }, 1213 destroyDateTimePicker = function( input ) { 1214 var datetimepicker = input.data('xdsoft_datetimepicker'); 1215 if( datetimepicker ) { 1216 datetimepicker.data('xdsoft_datetime',null); 1217 datetimepicker.remove(); 1218 input 1219 .data( 'xdsoft_datetimepicker',null ) 1220 .off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft' ); 1221 $(window).off('resize.xdsoft'); 1222 $([window,document.body]).off('mousedown.xdsoft'); 1223 input.unmousewheel&&input.unmousewheel(); 1224 } 1225 }; 1226 $(document) 1227 .off('keydown.xdsoftctrl keyup.xdsoftctrl') 1228 .on('keydown.xdsoftctrl',function(e) { 1229 if ( e.keyCode == CTRLKEY ) 1230 ctrlDown = true; 1231 }) 1232 .on('keyup.xdsoftctrl',function(e) { 1233 if ( e.keyCode == CTRLKEY ) 1234 ctrlDown = false;
1235 }); 1236 return this.each(function() { 1237 var datetimepicker; 1238 if( datetimepicker = $(this).data('xdsoft_datetimepicker') ) { 1239 if( $.type(opt) === 'string' ) { 1240 switch(opt) { 1241 case 'show': 1242 $(this).select().focus(); 1243 datetimepicker.trigger( 'open.xdsoft' ); 1244 break; 1245 case 'hide': 1246 datetimepicker.trigger('close.xdsoft'); 1247 break; 1248 case 'destroy': 1249 destroyDateTimePicker($(this)); 1250 break; 1251 case 'reset': 1252 this.value = this.defaultValue; 1253 if(!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) 1254 datetimepicker.data('changed',false); 1255 datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); 1256 break; 1257 } 1258 }else{ 1259 datetimepicker 1260 .setOptions(opt); 1261 } 1262 return 0; 1263 }else 1264 if( ($.type(opt) !== 'string') ){ 1265 if( !options.lazyInit||options.open||options.inline ){ 1266 createDateTimePicker($(this)); 1267 }else 1268 lazyInit($(this)); 1269 } 1270 }); 1271 }; 1272})( jQuery ); 1273 1274//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/ 1275/* 1276 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org> 1277 * 1278 * This program is free software; you can redistribute it and/or modify it 1279 * under the terms of the GNU Lesser General Public License as published by the
1280 * Free Software Foundation, version 2.1. 1281 * 1282 * This program is distributed in the hope that it will be useful, but WITHOUT 1283 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 1284 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 1285 * details. 1286 */ 1287Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}eval(code.substring(0,code.length-3)+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,
1287s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"}; 1288/* 1289 * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) 1290 * 1291 * Licensed under the MIT License (LICENSE.txt). 1292 * 1293 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 1294 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 1295 * Thanks to: Seamus Leahy for adding deltaX and deltaY 1296 * 1297 * Version: 3.1.3 1298 * 1299 * Requires: 1.2.2+ 1300 */ 1301(function(factory) {if(typeof define==='function'&&define.amd) {define(['jquery.flot.min'],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
1301(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)}})); 1302 1303/*! 1304 * Parsleyjs 1305 * Guillaume Potier - <[email protected]> 1306 * Version 2.1.3 - built Wed Jul 29 2015 08:27:00 1307 * MIT Licensed 1308 * 1309 */ 1310!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(a,b){return a.parsleyAdaptedCallback||(a.parsleyAdaptedCallback=function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(this),a.apply(b||q,c)}),a.parsleyAdaptedCallback}function c(a){return 0===a.lastIndexOf(s,0)?a.substr(s.length):a}"undefined"==typeof a&&"undefined"!=typeof window.jQuery&&(a=window.jQuery);var d=1,e={},f={attr:function(a,b,c){var d,e,f=new RegExp("^"+b,"i");if("undefined"==typeof c)c={};else for(var g in c)c.hasOwnProperty(g)&&delete c[g];if("undefined"==typeof a||"undefined"==typeof a[0])return c;e=a[0].attributes;for(var g=e.length;g--;)d=e[g],d&&d.specified&&f.test(d.name)&&(c[this.camelize(d.name.slice(b.length))]=this.deserializeValue(d.value));return c},checkAttr:function(a,b,c){return a.is("["+b+c+"]")},setAttr:function(a,b,c,d){a[0].setAttribute(this.dasherize(b+c),String(d))},generateID:function(){return""+d++},deserializeValue:function(b){var c;try{return b?"true"==b||("false"==b?!1:"null"==b?null:isNaN(c=Number(b))?/^[\[\{]/.test(b)?a.parseJSON(b):b:c):b}catch(d){return b}},camelize:function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},dasherize:function(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()},warn:function(){window.console&&"function"==typeof window.console.warn&&window.console.warn.apply(window.console,arguments)},warnOnce:function(a){e[a]||(e[a]=!0,this.warn.apply(this,arguments))},_resetWarnings:function(){e={}},objectCreate:Object.create||function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()},g={namespace:"data-parsley-",inputs:"input, textarea, select",excluded:"input[type=button], input[type=submit], input[type=reset], input[type=hidden]",priorityEnabled:!0,multiple:null,group:null,uiEnabled:!0,validationThreshold:3,focus:"first",trigger:!1,errorClass:"parsley-error",successClass:"parsley-success",classHandler:function(){},errorsContainer:function(){},errorsWrapper:'<ul class="parsley-errors-list"></ul>',errorTemplate:"<li></li>"},h=function(){};h.prototype={asyncSupport:!1,actualizeOptions:function(){return f.attr(this.$element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(a){this.domOptions=f.objectCreate(this.parent.options),this.options=f.objectCreate(this.domOptions);for(var b in a)a.hasOwnProperty(b)&&(this.options[b]=a[b]);this.actualizeOptions()},validateThroughValidator:function(a,b,c){return window.ParsleyValidator.validate(a,b,c)},_listeners:null,on:function(a,b){this._listeners=this._listeners||{};var c=this._listeners[a]=this._listeners[a]||[];return c.push(b),this},subscribe:function(b,c){a.listenTo(this,b.toLowerCase(),c)},off:function(a,b){var c=this._listeners&&this._listeners[a];if(c)if(b)for(var d=c.length;d--;)c[d]===b&&c.splice(d,1);else delete this._listeners[a];return this},unsubscribe:function(b){a.unsubscribeTo(this,b.toLowerCase())},trigger:function(a,b){b=b||this;var c,d=this._listeners&&this._listeners[a];if(d)for(var e=d.length;e--;)if(c=d[e].call(b,b),c===!1)return c;return this.parent?this.parent.trigger(a,b):!0},reset:function(){if("ParsleyForm"!==this.__class__)return this._trigger("reset");for(var a=0;a<this.fields.length;a++)this.fields[a]._trigger("reset");this._trigger("reset")},destroy:function(){if("ParsleyForm"!==this.__class__)return this.$element.removeData("Parsley"),this.$element.removeData("ParsleyFieldMultiple"),void this._trigger("destroy");for(var a=0;a<this.fields.length;a++)this.fields[a].destroy();this.$element.removeData("Parsley"),this._trigger("destroy")},_findRelatedMultiple:function(){return this.parent.$element.find("["+this.options.namespace+'multiple="'+this.options.multiple+'"]')}};var i=function(){var a={},b=function(a){this.__class__="Validator",this.__version__="1.0.1",this.options=a||{},this.bindingKey=this.options.bindingKey||"_validatorjsConstraint"};b.prototype={constructor:b,validate:function(a,b,c){if("string"!=typeof a&&"object"!=typeof a)throw new Error("You must validate an object or a string");
1310return"string"==typeof a||g(a)?this._validateString(a,b,c):this.isBinded(a)?this._validateBindedObject(a,b):this._validateObject(a,b,c)},bind:function(a,b){if("object"!=typeof a)throw new Error("Must bind a Constraint to an object");return a[this.bindingKey]=new c(b),this},unbind:function(a){return"undefined"==typeof a._validatorjsConstraint?this:(delete a[this.bindingKey],this)},isBinded:function(a){return"undefined"!=typeof a[this.bindingKey]},getBinded:function(a){return this.isBinded(a)?a[this.bindingKey]:null},_validateString:function(a,b,c){var f,h=[];g(b)||(b=[b]);for(var i=0;i<b.length;i++){if(!(b[i]instanceof e))throw new Error("You must give an Assert or an Asserts array to validate a string");f=b[i].check(a,c),f instanceof d&&h.push(f)}return h.length?h:!0},_validateObject:function(a,b,d){if("object"!=typeof b)throw new Error("You must give a constraint to validate an object");return b instanceof c?b.check(a,d):new c(b).check(a,d)},_validateBindedObject:function(a,b){return a[this.bindingKey].check(a,b)}},b.errorCode={must_be_a_string:"must_be_a_string",must_be_an_array:"must_be_an_array",must_be_a_number:"must_be_a_number",must_be_a_string_or_array:"must_be_a_string_or_array"};var c=function(a,b){if(this.__class__="Constraint",this.options=b||{},this.nodes={},a)try{this._bootstrap(a)}catch(c){throw new Error("Should give a valid mapping object to Constraint",c,a)}};c.prototype={constructor:c,check:function(a,b){var c,d={};for(var h in this.nodes){for(var i=!1,j=this.get(h),k=g(j)?j:[j],l=k.length-1;l>=0;l--)"Required"!==k[l].__class__||(i=k[l].requiresValidation(b));if(this.has(h,a)||this.options.strict||i)try{this.has(h,this.options.strict||i?a:void 0)||(new e).HaveProperty(h).validate(a),c=this._check(h,a[h],b),(g(c)&&c.length>0||!g(c)&&!f(c))&&(d[h]=c)}catch(m){d[h]=m}}return f(d)?!0:d},add:function(a,b){if(b instanceof e||g(b)&&b[0]instanceof e)return this.nodes[a]=b,this;if("object"==typeof b&&!g(b))return this.nodes[a]=b instanceof c?b:new c(b),this;throw new Error("Should give an Assert, an Asserts array, a Constraint",b)},has:function(a,b){return b="undefined"!=typeof b?b:this.nodes,"undefined"!=typeof b[a]},get:function(a,b){return this.has(a)?this.nodes[a]:b||null},remove:function(a){var b=[];for(var c in this.nodes)c!==a&&(b[c]=this.nodes[c]);return this.nodes=b,this},_bootstrap:function(a){if(a instanceof c)return this.nodes=a.nodes;for(var b in a)this.add(b,a[b])},_check:function(a,b,d){if(this.nodes[a]instanceof e)return this._checkAsserts(b,[this.nodes[a]],d);if(g(this.nodes[a]))return this._checkAsserts(b,this.nodes[a],d);if(this.nodes[a]instanceof c)return this.nodes[a].check(b,d);throw new Error("Invalid node",this.nodes[a])},_checkAsserts:function(a,b,c){for(var d,e=[],f=0;f<b.length;f++)d=b[f].check(a,c),"undefined"!=typeof d&&!0!==d&&e.push(d);return e}};var d=function(a,b,c){if(this.__class__="Violation",!(a instanceof e))throw new Error("Should give an assertion implementing the Assert interface");this.assert=a,this.value=b,"undefined"!=typeof c&&(this.violation=c)};d.prototype={show:function(){var a={assert:this.assert.__class__,value:this.value};return this.violation&&(a.violation=this.violation),a},__toString:function(){return"undefined"!=typeof this.violation&&(this.violation='", '+this.getViolation().constraint+" expected was "+this.getViolation().expected),this.assert.__class__+' assert failed for "'+this.value+this.violation||""},getViolation:function(){var a,b;for(a in this.violation)b=this.violation[a];return{constraint:a,expected:b}}};var e=function(a){this.__class__="Assert",this.__parentClass__=this.__class__,this.groups=[],"undefined"!=typeof a&&this.addGroup(a)};e.prototype={construct:e,requiresValidation:function(a){return a&&!this.hasGroup(a)?!1:!a&&this.hasGroups()?!1:!0},check:function(a,b){if(this.requiresValidation(b))try{return this.validate(a,b)}catch(c){return c}},hasGroup:function(a){return g(a)?this.hasOneOf(a):"Any"===a?!0:this.hasGroups()?-1!==this.groups.indexOf(a):"Default"===a},hasOneOf:function(a){for(var b=0;b<a.length;b++)if(this.hasGroup(a[b]))return!0;return!1},hasGroups:function(){return this.groups.length>0},addGroup:function(a){return g(a)?this.addGroups(a):(this.hasGroup(a)||this.groups.push(a),this)},removeGroup:function(a){for(var b=[],c=0;c<this.groups.length;c++)a!==this.groups[c]&&b.push(this.groups[c]);return this.groups=b,this},addGroups:function(a){for(var b=0;b<a.length;b++)this.addGroup(a[b]);return this},HaveProperty:function(a){return this.__class__="HaveProperty",this.node=a,this.validate=function(a){if
1310("undefined"==typeof a[this.node])throw new d(this,a,{value:this.node});return!0},this},Blank:function(){return this.__class__="Blank",this.validate=function(a){if("string"!=typeof a)throw new d(this,a,{value:b.errorCode.must_be_a_string});if(""!==a.replace(/^\s+/g,"").replace(/\s+$/g,""))throw new d(this,a);return!0},this},Callback:function(a){if(this.__class__="Callback",this.arguments=Array.prototype.slice.call(arguments),1===this.arguments.length?this.arguments=[]:this.arguments.splice(0,1),"function"!=typeof a)throw new Error("Callback must be instanciated with a function");return this.fn=a,this.validate=function(a){var b=this.fn.apply(this,[a].concat(this.arguments));if(!0!==b)throw new d(this,a,{result:b});return!0},this},Choice:function(a){if(this.__class__="Choice",!g(a)&&"function"!=typeof a)throw new Error("Choice must be instanciated with an array or a function");return this.list=a,this.validate=function(a){for(var b="function"==typeof this.list?this.list():this.list,c=0;c<b.length;c++)if(a===b[c])return!0;throw new d(this,a,{choices:b})},this},Collection:function(a){return this.__class__="Collection",this.constraint="undefined"!=typeof a?a instanceof e?a:new c(a):!1,this.validate=function(a,c){var e,h=new b,i=0,j={},k=this.groups.length?this.groups:c;if(!g(a))throw new d(this,a,{value:b.errorCode.must_be_an_array});for(var l=0;l<a.length;l++)e=this.constraint?h.validate(a[l],this.constraint,k):h.validate(a[l],k),f(e)||(j[i]=e),i++;return f(j)?!0:j},this},Count:function(a){return this.__class__="Count",this.count=a,this.validate=function(a){if(!g(a))throw new d(this,a,{value:b.errorCode.must_be_an_array});var c="function"==typeof this.count?this.count(a):this.count;if(isNaN(Number(c)))throw new Error("Count must be a valid interger",c);if(c!==a.length)throw new d(this,a,{count:c});return!0},this},Email:function(){return this.__class__="Email",this.validate=function(a){var c=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;if("string"!=typeof a)throw new d(this,a,{value:b.errorCode.must_be_a_string});if(!c.test(a))throw new d(this,a);return!0},this},EqualTo:function(a){if(this.__class__="EqualTo","undefined"==typeof a)throw new Error("EqualTo must be instanciated with a value or a function");return this.reference=a,this.validate=function(a){var b="function"==typeof this.reference?this.reference(a):this.reference;if(b!==a)throw new d(this,a,{value:b});return!0},this},GreaterThan:function(a){if(this.__class__="GreaterThan","undefined"==typeof a)throw new Error("Should give a threshold value");return this.threshold=a,this.validate=function(a){if(""===a||isNaN(Number(a)))throw new d(this,a,{value:b.errorCode.must_be_a_number});if(this.threshold>=a)throw new d(this,a,{threshold:this.threshold});return!0},this},GreaterThanOrEqual:function(a){if(this.__class__="GreaterThanOrEqual","undefined"==typeof a)throw new Error("Should give a threshold value");return this.threshold=a,this.validate=function(a){if(""===a||isNaN(Number(a)))throw new d(this,a,{value:b.errorCode.must_be_a_number});if(this.threshold>a)throw new d(this,a,{threshold:this.threshold});return!0},this},InstanceOf:function(a){if(this.__class__="InstanceOf","undefined"==typeof a)throw new Error("InstanceOf must be instanciated with a value");
1310return this.classRef=a,this.validate=function(a){if(!0!=a instanceof this.classRef)throw new d(this,a,{classRef:this.classRef});return!0},this},Length:function(a){if(this.__class__="Length",!a.min&&!a.max)throw new Error("Lenth assert must be instanciated with a { min: x, max: y } object");return this.min=a.min,this.max=a.max,this.validate=function(a){if("string"!=typeof a&&!g(a))throw new d(this,a,{value:b.errorCode.must_be_a_string_or_array});if("undefined"!=typeof this.min&&this.min===this.max&&a.length!==this.min)throw new d(this,a,{min:this.min,max:this.max});if("undefined"!=typeof this.max&&a.length>this.max)throw new d(this,a,{max:this.max});if("undefined"!=typeof this.min&&a.length<this.min)throw new d(this,a,{min:this.min});return!0},this},LessThan:function(a){if(this.__class__="LessThan","undefined"==typeof a)throw new Error("Should give a threshold value");return this.threshold=a,this.validate=function(a){if(""===a||isNaN(Number(a)))throw new d(this,a,{value:b.errorCode.must_be_a_number});if(this.threshold<=a)throw new d(this,a,{threshold:this.threshold});return!0},this},LessThanOrEqual:function(a){if(this.__class__="LessThanOrEqual","undefined"==typeof a)throw new Error("Should give a threshold value");return this.threshold=a,this.validate=function(a){if(""===a||isNaN(Number(a)))throw new d(this,a,{value:b.errorCode.must_be_a_number});if(this.threshold<a)throw new d(this,a,{threshold:this.threshold});return!0},this},NotNull:function(){return this.__class__="NotNull",this.validate=function(a){if(null===a||"undefined"==typeof a)throw new d(this,a);return!0},this},NotBlank:function(){return this.__class__="NotBlank",this.validate=function(a){if("string"!=typeof a)throw new d(this,a,{value:b.errorCode.must_be_a_string});if(""===a.replace(/^\s+/g,"").replace(/\s+$/g,""))throw new d(this,a);return!0},this},Null:function(){return this.__class__="Null",this.validate=function(a){if(null!==a)throw new d(this,a);return!0},this},Range:function(a,b){if(this.__class__="Range","undefined"==typeof a||"undefined"==typeof b)throw new Error("Range assert expects min and max values");return this.min=a,this.max=b,this.validate=function(a){try{return"string"==typeof a&&isNaN(Number(a))||g(a)?(new e).Length({min:this.min,max:this.max}).validate(a):(new e).GreaterThanOrEqual(this.min).validate(a)&&(new e).LessThanOrEqual(this.max).validate(a),!0}catch(b){throw new d(this,a,b.violation)}return!0},this},Regexp:function(a,c){if(this.__class__="Regexp","undefined"==typeof a)throw new Error("You must give a regexp");return this.regexp=a,this.flag=c||"",this.validate=function(a){if("string"!=typeof a)throw new d(this,a,{value:b.errorCode.must_be_a_string});if(!new RegExp(this.regexp,this.flag).test(a))throw new d(this,a,{regexp:this.regexp,flag:this.flag});return!0},this},Required:function(){return this.__class__="Required",this.validate=function(a){if("undefined"==typeof a)throw new d(this,a);try{"string"==typeof a?(new e).NotNull().validate(a)&&(new e).NotBlank().validate(a):!0===g(a)&&(new e).Length({min:1}).validate(a)}catch(b){throw new d(this,a)}return!0},this},Unique:function(a){return this.__class__="Unique","object"==typeof a&&(this.key=a.key),this.validate=function(a){var c,e=[];if(!g(a))throw new d(this,a,{value:b.errorCode.must_be_an_array});for(var f=0;f<a.length;f++)if(c="object"==typeof a[f]?a[f][this.key]:a[f],"undefined"!=typeof c){if(-1!==e.indexOf(c))throw new d(this,a,{value:c});e.push(c)}return!0},this}},a.Assert=e,a.Validator=b,a.Violation=d,a.Constraint=c,Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!==d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1});var f=function(a){for(var b in a)return!1;return!0},g=function(a){return"[object Array]"===Object.prototype.toString.call(a)};return"function"==typeof define&&define.amd?define("vendors/validator.js/dist/validator",[],function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:window["undefined"!=typeof validatorjs_ns?validatorjs_ns:"Validator"]=a,a}();i="undefined"!=typeof i?i:"undefined"!=typeof module?module.exports:null;var j=function(a,b){this.__class__="ParsleyValidator",this.Validator=i,this.locale="en",this.init(
1310a||{},b||{})};j.prototype={init:function(b,c){this.catalog=c,this.validators=a.extend({},this.validators);for(var d in b)this.addValidator(d,b[d].fn,b[d].priority,b[d].requirementsTransformer);window.Parsley.trigger("parsley:validator:init")},setLocale:function(a){if("undefined"==typeof this.catalog[a])throw new Error(a+" is not available in the catalog");return this.locale=a,this},addCatalog:function(a,b,c){return"object"==typeof b&&(this.catalog[a]=b),!0===c?this.setLocale(a):this},addMessage:function(a,b,c){return"undefined"==typeof this.catalog[a]&&(this.catalog[a]={}),this.catalog[a][b.toLowerCase()]=c,this},validate:function(){return(new this.Validator.Validator).validate.apply(new i.Validator,arguments)},addValidator:function(a,b,c,d){if(this.validators[a])f.warn('Validator "'+a+'" is already defined.');else if(g.hasOwnProperty(a))return void f.warn('"'+a+'" is a restricted keyword and is not a valid validator name.');return this._setValidator(a,b,c,d)},updateValidator:function(a,b,c,d){return this.validators[a]?this._setValidator(a,b,c,d):(f.warn('Validator "'+a+'" is not already defined.'),this.addValidator(a,b,c,d))},removeValidator:function(a){return this.validators[a]||f.warn('Validator "'+a+'" is not defined.'),delete this.validators[a],this},_setValidator:function(b,c,d,e){return this.validators[b]=function(b){return a.extend((new i.Assert).Callback(c,b),{priority:d,requirementsTransformer:e})},this},getErrorMessage:function(a){var b;if("type"===a.name){var c=this.catalog[this.locale][a.name]||{};b=c[a.requirements]}else b=this.formatMessage(this.catalog[this.locale][a.name],a.requirements);return b||this.catalog[this.locale].defaultMessage||this.catalog.en.defaultMessage},formatMessage:function(a,b){if("object"==typeof b){for(var c in b)a=this.formatMessage(a,b[c]);return a}return"string"==typeof a?a.replace(new RegExp("%s","i"),b):""},validators:{notblank:function(){return a.extend((new i.Assert).NotBlank(),{priority:2})},required:function(){return a.extend((new i.Assert).Required(),{priority:512})},type:function(b){var c;switch(b){case"email":c=(new i.Assert).Email();break;case"range":case"number":c=(new i.Assert).Regexp("^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)?(?:\\.\\d+)?$");break;case"integer":c=(new i.Assert).Regexp("^-?\\d+$");break;case"digits":c=(new i.Assert).Regexp("^\\d+$");break;case"alphanum":c=(new i.Assert).Regexp("^\\w+$","i");break;case"url":c=(new i.Assert).Regexp("^(?:(?:https?|ftp)://)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:/\\S*)?$","i");break;default:throw new Error("validator type `"+b+"` is not supported")}return a.extend(c,{priority:256})},pattern:function(b){var c="";return/^\/.*\/(?:[gimy]*)$/.test(b)&&(c=b.replace(/.*\/([gimy]*)$/,"$1"),b=b.replace(new RegExp("^/(.*?)/"+c+"$"),"$1")),a.extend((new i.Assert).Regexp(b,c),{priority:64})},minlength:function(b){return a.extend((new i.Assert).Length({min:b}),{priority:30,requirementsTransformer:function(){return"string"!=typeof b||isNaN(b)?b:parseInt(b,10)}})},maxlength:function(b){return a.extend((new i.Assert).Length({max:b}),{priority:30,requirementsTransformer:function(){return"string"!=typeof b||isNaN(b)?b:parseInt(b,10)}})},length:function(b){return a.extend((new i.Assert).Length({min:b[0],max:b[1]}),{priority:32})},mincheck:function(a){return this.minlength(a)},maxcheck:function(a){return this.maxlength(a)},check:function(a){return this.length(a)},min:function(b){return a.extend((new i.Assert).GreaterThanOrEqual(b),{priority:30,requirementsTransformer:function(){return"string"!=typeof b||isNaN(b)?b:parseInt(b,10)}})},max:function(b){return a.extend((new i.Assert).LessThanOrEqual(b),{priority:30,requirementsTransformer:function(){return"string"!=typeof b||isNaN(b)?b:parseInt(b,10)}})},range:function(b){return a.extend((new i.Assert).Range(b[0],b[1]),{priority:32,requirementsTransformer:function(){for(var a=0;a<b.length;a++)b[a]="string"!=typeof b[a]||isNaN(b[a])?b[a]:parseInt(b[a],10);return b}})},equalto:function(b){return a.extend((new i.Assert).EqualTo(b),{priority:256,requirementsTransformer:function(){return a(b).length?a(b).val():b}})}}};var k=function(){this.__class__="ParsleyUI"};k.prototype={listen:function(){var a=this;return window.Parsley.on("form:init",function(){a.setupForm(this)}).on("field:init",function(){a.setupField(this)}).on("field:validated",function(){a.reflow(this)}).on("form:validated",function(){a.focus(this)}).on("field:reset",function(){a.reset(this)}).on("form:destroy",function(){a.destroy(this)}).on("field:destroy",function(){a.destroy(this)}),this}
1310,reflow:function(a){if("undefined"!=typeof a._ui&&!1!==a._ui.active){var b=this._diff(a.validationResult,a._ui.lastValidationResult);a._ui.lastValidationResult=a.validationResult,a._ui.validatedOnce=!0,this.manageStatusClass(a),this.manageErrorsMessages(a,b),this.actualizeTriggers(a),(b.kept.length||b.added.length)&&!0!==a._ui.failedOnce&&this.manageFailingFieldTrigger(a)}},getErrorsMessages:function(a){if(!0===a.validationResult)return[];for(var b=[],c=0;c<a.validationResult.length;c++)b.push(this._getErrorMessage(a,a.validationResult[c].assert));return b},manageStatusClass:function(a){a.hasConstraints()&&a.needsValidation()&&!0===a.validationResult?this._successClass(a):a.validationResult.length>0?this._errorClass(a):this._resetClass(a)},manageErrorsMessages:function(b,c){if("undefined"==typeof b.options.errorsMessagesDisabled){if("undefined"!=typeof b.options.errorMessage)return c.added.length||c.kept.length?(this._insertErrorWrapper(b),0===b._ui.$errorsWrapper.find(".parsley-custom-error-message").length&&b._ui.$errorsWrapper.append(a(b.options.errorTemplate).addClass("parsley-custom-error-message")),b._ui.$errorsWrapper.addClass("filled").find(".parsley-custom-error-message").html(b.options.errorMessage)):b._ui.$errorsWrapper.removeClass("filled").find(".parsley-custom-error-message").remove();for(var d=0;d<c.removed.length;d++)this.removeError(b,c.removed[d].assert.name,!0);for(d=0;d<c.added.length;d++)this.addError(b,c.added[d].assert.name,void 0,c.added[d].assert,!0);for(d=0;d<c.kept.length;d++)this.updateError(b,c.kept[d].assert.name,void 0,c.kept[d].assert,!0)}},addError:function(b,c,d,e,f){this._insertErrorWrapper(b),b._ui.$errorsWrapper.addClass("filled").append(a(b.options.errorTemplate).addClass("parsley-"+c).html(d||this._getErrorMessage(b,e))),!0!==f&&this._errorClass(b)},updateError:function(a,b,c,d,e){a._ui.$errorsWrapper.addClass("filled").find(".parsley-"+b).html(c||this._getErrorMessage(a,d)),!0!==e&&this._errorClass(a)},removeError:function(a,b,c){a._ui.$errorsWrapper.removeClass("filled").find(".parsley-"+b).remove(),!0!==c&&this.manageStatusClass(a)},focus:function(a){if(a._focusedField=null,!0===a.validationResult||"none"===a.options.focus)return null;for(var b=0;b<a.fields.length;b++){var c=a.fields[b];if(!0!==c.validationResult&&c.validationResult.length>0&&"undefined"==typeof c.options.noFocus&&(a._focusedField=c.$element,"first"===a.options.focus))break}return null===a._focusedField?null:a._focusedField.focus()},_getErrorMessage:function(a,b){var c=b.name+"Message";return"undefined"!=typeof a.options[c]?window.ParsleyValidator.formatMessage(a.options[c],b.requirements):window.ParsleyValidator.getErrorMessage(b)},_diff:function(a,b,c){for(var d=[],e=[],f=0;f<a.length;f++){for(var g=!1,h=0;h<b.length;h++)if(a[f].assert.name===b[h].assert.name){g=!0;break}g?e.push(a[f]):d.push(a[f])}return{kept:e,added:d,removed:c?[]:this._diff(b,a,!0).added}},setupForm:function(b){b.$element.on("submit.Parsley",!1,a.proxy(b.onSubmitValidate,b)),!1!==b.options.uiEnabled&&b.$element.attr("novalidate","")},setupField:function(b){var c={active:!1};!1!==b.options.uiEnabled&&(c.active=!0,b.$element.attr(b.options.namespace+"id",b.__id__),c.$errorClassHandler=this._manageClassHandler(b),c.errorsWrapperId="parsley-id-"+(b.options.multiple?"multiple-"+b.options.multiple:b.__id__),c.$errorsWrapper=a(b.options.errorsWrapper).attr("id",c.errorsWrapperId),c.lastValidationResult=[],c.validatedOnce=!1,c.validationInformationVisible=!1,b._ui=c,this.actualizeTriggers(b))},_manageClassHandler:function(b){if("string"==typeof b.options.classHandler&&a(b.options.classHandler).length)return a(b.options.classHandler);var c=b.options.classHandler(b);return"undefined"!=typeof c&&c.length?c:!b.options.multiple||b.$element.is("select")?b.$element:b.$element.parent()},_insertErrorWrapper:function(b){var c;if(0!==b._ui.$errorsWrapper.parent().length)return b._ui.$errorsWrapper.parent();if("string"==typeof b.options.errorsContainer){if(a(b.options.errorsContainer).length)return a(b.options.errorsContainer).append(b._ui.$errorsWrapper);f.warn("The errors container `"+b.options.errorsContainer+"` does not exist in DOM")}else"function"==typeof b.options.errorsContainer&&(c=b.options.errorsContainer(b));if("undefined"!=typeof c&&c.length)return c.append(b._ui.$errorsWrapper);var d=b.$element;return b.options.multiple&&(d=d.parent()),d.after(b._ui.$errorsWrapper)},actualizeTriggers:function(b){var c=b.$element;if(b.options.multiple&&(c=a("["+b.options.namespace+'multiple="'+b.options.multiple+'"]')),c.off(".Parsley"),!1!==b.o
1310ptions.trigger){var d=b.options.trigger.replace(/^\s+/g,"").replace(/\s+$/g,"");""!==d&&c.on(d.split(" ").join(".Parsley ")+".Parsley",a.proxy("function"==typeof b.eventValidate?b.eventValidate:this.eventValidate,b))}},eventValidate:function(a){new RegExp("key").test(a.type)&&!this._ui.validationInformationVisible&&this.getValue().length<=this.options.validationThreshold||(this._ui.validatedOnce=!0,this.validate())},manageFailingFieldTrigger:function(b){return b._ui.failedOnce=!0,b.options.multiple&&a("["+b.options.namespace+'multiple="'+b.options.multiple+'"]').each(function(){return new RegExp("change","i").test(a(this).parsley().options.trigger||"")?void 0:a(this).on("change.ParsleyFailedOnce",!1,a.proxy(b.validate,b))}),b.$element.is("select")&&!new RegExp("change","i").test(b.options.trigger||"")?b.$element.on("change.ParsleyFailedOnce",!1,a.proxy(b.validate,b)):new RegExp("keyup","i").test(b.options.trigger||"")?void 0:b.$element.on("keyup.ParsleyFailedOnce",!1,a.proxy(b.validate,b))},reset:function(a){this.actualizeTriggers(a),a.$element.off(".ParsleyFailedOnce"),"undefined"!=typeof a._ui&&"ParsleyForm"!==a.__class__&&(a._ui.$errorsWrapper.removeClass("filled").children().remove(),this._resetClass(a),a._ui.validatedOnce=!1,a._ui.lastValidationResult=[],a._ui.validationInformationVisible=!1,a._ui.failedOnce=!1)},destroy:function(a){this.reset(a),"ParsleyForm"!==a.__class__&&("undefined"!=typeof a._ui&&a._ui.$errorsWrapper.remove(),delete a._ui)},_successClass:function(a){a._ui.validationInformationVisible=!0,a._ui.$errorClassHandler.removeClass(a.options.errorClass).addClass(a.options.successClass)},_errorClass:function(a){a._ui.validationInformationVisible=!0,a._ui.$errorClassHandler.removeClass(a.options.successClass).addClass(a.options.errorClass)},_resetClass:function(a){a._ui.$errorClassHandler.removeClass(a.options.successClass).removeClass(a.options.errorClass)}};var l=function(b,c,d){this.__class__="ParsleyForm",this.__id__=f.generateID(),this.$element=a(b),this.domOptions=c,this.options=d,this.parent=window.Parsley,this.fields=[],this.validationResult=null};l.prototype={onSubmitValidate:function(b){return this.validate(void 0,void 0,b),(!1===this.validationResult||!this._trigger("submit"))&&b instanceof a.Event&&(b.stopImmediatePropagation(),b.preventDefault()),this},validate:function(a,b,c){this.submitEvent=c,this.validationResult=!0;var d=[];return this._trigger("validate"),this._refreshFields(),this._withoutReactualizingFormOptions(function(){for(var c=0;c<this.fields.length;c++)(!a||this._isFieldInGroup(this.fields[c],a))&&(d=this.fields[c].validate(b),!0!==d&&d.length>0&&this.validationResult&&(this.validationResult=!1))}),this._trigger(this.validationResult?"success":"error"),this._trigger("validated"),this.validationResult},isValid:function(a,b){return this._refreshFields(),this._withoutReactualizingFormOptions(function(){for(var c=0;c<this.fields.length;c++)if((!a||this._isFieldInGroup(this.fields[c],a))&&!1===this.fields[c].isValid(b))return!1;return!0})},_isFieldInGroup:function(b,c){return a.isArray(b.options.group)?-1!==a.inArray(c,b.options.group):b.options.group===c},_refreshFields:function(){return this.actualizeOptions()._bindFields()},_bindFields:function(){var b=this,c=this.fields;return this.fields=[],this.fieldsMappedById={},this._withoutReactualizingFormOptions(function(){this.$element.find(this.options.inputs).not(this.options.excluded).each(function(){var a=new t.Factory(this,{},b);"ParsleyField"!==a.__class__&&"ParsleyFieldMultiple"!==a.__class__||!0===a.options.excluded||"undefined"==typeof b.fieldsMappedById[a.__class__+"-"+a.__id__]&&(b.fieldsMappedById[a.__class__+"-"+a.__id__]=a,b.fields.push(a))}),a(c).not(b.fields).each(function(){this._trigger("reset")})}),this},_withoutReactualizingFormOptions:function(a){var b=this.actualizeOptions;this.actualizeOptions=function(){return this};var c=a.call(this);return this.actualizeOptions=b,c},_trigger:function(a){return a="form:"+a,this.trigger.apply(this,arguments)}};var m=function(b,c,d,e,g){var h={};if(!new RegExp("ParsleyField").test(b.__class__))throw new Error("ParsleyField or ParsleyFieldMultiple instance expected");if("function"==typeof window.ParsleyValidator.validators[c]&&(h=window.ParsleyValidator.validators[c](d)),"Assert"!==h.__parentClass__)throw new Error("Valid validator expected");var i=function(){return"undefined"!=typeof b.options[c+"Priority"]?b.options[c+"Priority"]:h.priority||2};return e=e||i(),"function"==typeof h.requirementsTransformer&&(d=h.requirementsTransformer(),h=window.ParsleyValidator.validators[c](d)),a.extend(h,{name:c,requirements:d,priority:e,groups:[e],isDomConstraint:g||f.checkAttr(b.$element,b.options.namespace,c)})},n=function(b,c,d,e){this.__class__="ParsleyField",this.__id__=f.generateID(),this.$element=a(b),"undefined"!=typeof e&&(this.parent=e),this.options=d,this.domOptions=c,this.constraints=[],this.constraintsByName={},this.validationResult=[], 1311 this._bindConstraints()};n.prototype={validate:function(a){return this.value=this.getValue(),this._trigger("validate"),this._trigger(this.isValid(a,this.value)?"success":"error"),this._trigger("validated"),this.validationResult},hasConstraints:function(){return 0!==this.constraints.length},needsValidation:function(a){return"undefined"==typeof a&&(a=this.getValue()),a.length||this._isRequired()||"undefined"!=typeof this.options.validateIfEmpty?!0:!1},isValid:function(a,b){if(this.refreshConstraints(),this.validationResult=!0,!this.hasConstraints())return!0;
1311if(("undefined"==typeof b||null===b)&&(b=this.getValue()),!this.needsValidation(b)&&!0!==a)return!0;var c=["Any"];!1!==this.options.priorityEnabled&&(c=this._getConstraintsSortedPriorities());for(var d=0;d<c.length;d++)if(!0!==(this.validationResult=this.validateThroughValidator(b,this.constraints,c[d])))return!1;return!0},getValue:function(){var a;return a="function"==typeof this.options.value?this.options.value(this):"undefined"!=typeof this.options.value?this.options.value:this.$element.val(),"undefined"==typeof a||null===a?"":this._handleWhitespace(a)},refreshConstraints:function(){return this.actualizeOptions()._bindConstraints()},addConstraint:function(a,b,c,d){if("function"==typeof window.ParsleyValidator.validators[a]){var e=new m(this,a,b,c,d);"undefined"!==this.constraintsByName[e.name]&&this.removeConstraint(e.name),this.constraints.push(e),this.constraintsByName[e.name]=e}return this},removeConstraint:function(a){for(var b=0;b<this.constraints.length;b++)if(a===this.constraints[b].name){this.constraints.splice(b,1);break}return delete this.constraintsByName[a],this},updateConstraint:function(a,b,c){return this.removeConstraint(a).addConstraint(a,b,c)},_bindConstraints:function(){for(var a=[],b={},c=0;c<this.constraints.length;c++)!1===this.constraints[c].isDomConstraint&&(a.push(this.constraints[c]),b[this.constraints[c].name]=this.constraints[c]);this.constraints=a,this.constraintsByName=b;for(var d in this.options)this.addConstraint(d,this.options[d]);return this._bindHtml5Constraints()},_bindHtml5Constraints:function(){(this.$element.hasClass("required")||this.$element.attr("required"))&&this.addConstraint("required",!0,void 0,!0),"string"==typeof this.$element.attr("pattern")&&this.addConstraint("pattern",this.$element.attr("pattern"),void 0,!0),"undefined"!=typeof this.$element.attr("min")&&"undefined"!=typeof this.$element.attr("max")?this.addConstraint("range",[this.$element.attr("min"),this.$element.attr("max")],void 0,!0):"undefined"!=typeof this.$element.attr("min")?this.addConstraint("min",this.$element.attr("min"),void 0,!0):"undefined"!=typeof this.$element.attr("max")&&this.addConstraint("max",this.$element.attr("max"),void 0,!0),"undefined"!=typeof this.$element.attr("minlength")&&"undefined"!=typeof this.$element.attr("maxlength")?this.addConstraint("length",[this.$element.attr("minlength"),this.$element.attr("maxlength")],void 0,!0):"undefined"!=typeof this.$element.attr("minlength")?this.addConstraint("minlength",this.$element.attr("minlength"),void 0,!0):"undefined"!=typeof this.$element.attr("maxlength")&&this.addConstraint("maxlength",this.$element.attr("maxlength"),void 0,!0);var a=this.$element.attr("type");return"undefined"==typeof a?this:"number"===a?"undefined"==typeof this.$element.attr("step")||0===parseFloat(this.$element.attr("step"))%1?this.addConstraint("type","integer",void 0,!0):this.addConstraint("type","number",void 0,!0):/^(email|url|range)$/i.test(a)?this.addConstraint("type",a,void 0,!0):this},_isRequired:function(){return"undefined"==typeof this.constraintsByName.required?!1:!1!==this.constraintsByName.required.requirements},_trigger:function(a){return a="field:"+a,this.trigger.apply(this,arguments)},_handleWhitespace:function(a){return!0===this.options.trimValue&&f.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'),"squish"===this.options.whitespace&&(a=a.replace(/\s{2,}/g," ")),("trim"===this.options.whitespace||"squish"===this.options.whitespace||!0===this.options.trimValue)&&(a=a.replace(/^\s+|\s+$/g,"")),a},_getConstraintsSortedPriorities:function(){for(var a=[],b=0;b<this.constraints.length;b++)-1===a.indexOf(this.constraints[b].priority)&&a.push(this.constraints[b].priority);return a.sort(function(a,b){return b-a}),a}};var o=function(){this.__class__="ParsleyFieldMultiple"};o.prototype={addElement:function(a){return this.$elements.push(a),this},refreshConstraints:function(){var b;if(this.constraints=[],this.$element.is("select"))return this.actualizeOptions()._bindConstraints(),this;for(var c=0;c<this.$elements.length;c++)if(a("html").has(this.$elements[c]).length){b=this.$elements[c].data("ParsleyFieldMultiple").refreshConstraints().constraints;for(var d=0;d<b.length;d++)this.addConstraint(b[d].name,b[d].requirements,b[d].priority,b[d].isDomConstraint)}else this.$elements.splice(c,1);return this},getValue:function(){if("undefined"!=typeof this.options.value)return this.options.value;if(this.$element.is("input[type=radio]"))return this._findRelatedMultiple().filter(":checked").val()||"";if(this.$element.is("input[type=checkbox]")){var b=[];return this._findRelatedMultiple().filter(":checked").each(function(){b.push(a(this).val())}),b}return this.$element.is("select")&&null===this.$element.val()?[]:this.$element.val()},_init:function(){return this.$elements=[this.$element],this}};var p=function(b,c,d){this.$element=a(b);var e=this.$element.data("Parsley");if(e)return"undefined"!=typeof d&&e.parent===window.Parsley&&(e.parent=d,e._resetOptions(e.options)),e;if(!this.$element.length)throw new Error("You must bind Parsley on an existing element.");if("undefined"!=typeof d&&"ParsleyForm"!==d.__class__)throw new Error("Parent instance must be a ParsleyForm instance");return this.parent=d||window.Parsley,this.init(c)};p.prototype={init:function(a){return this.__class__="Parsley",this.__version__="2.1.3",this.__id__=f.generateID(),this._resetOptions(a),this.$element.is("form")||f.checkAttr(this.$element,this.options.namespace,"validate")&&!this.$element.is(this.options.inputs)?this.bind("parsleyForm"):this.isMultiple()?this.handleMultiple():this.bind("parsleyField")},isMultiple:function(){return this.$element.is("input[type=radio], input[type=checkbox]")||this.$element.is("select")&&"undefined"!=typeof this.$element.attr("multiple")},handleMultiple:function(){var b,c,d=this;if(this.options.multiple||("undefined"!=typeof this.$element.attr("name")&&this.$element.attr("name").length?this.options.multiple=b=this.$element.attr("name"):"undefined"!=typeof this.$element.attr("id")&&this.$element.attr("id").length&&(this.options.multiple=this.$element.attr("id"))),this.$element.is("select")&&"undefined"!=typeof this.$element.attr("multiple"))return this.options.multiple=this.options.multiple||this.__id__,this.bind("parsleyFieldMultiple");if(!this.options.multiple)return f.warn("To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.",this.$element),this;this.options.multiple=this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g,""),"undefined"!=typeof b&&a('input[name="'+b+'"]').each(function(){a(this).is("input[type=radio], input[type=checkbox]")&&a(this).attr(d.options.namespace+"multiple",d.options.multiple)});for(var e=this._findRelatedMultiple(),g=0;g<e.length;g++)if(c=a(e.get(g)).data("Parsley"),"undefined"!=typeof c){this.$element.data("ParsleyFieldMultiple")||c.addElement(this.$element);break}return this.bind("parsleyField",!0),c||this.bind("parsleyFieldMultiple")},bind:function(b,c){var d;switch(b){case"parsleyForm":d=a.extend(new l(this.$element,this.domOptions,this.options),window.ParsleyExtend)._bindFields();break;case"parsleyField":d=a.extend(new n(this.$element,this.domOptions,this.options,this.parent),window.ParsleyExtend);break;case"parsleyFieldMultiple":d=a.extend(new n(this.$element,this.domOptions,this.options,this.parent),new o,window.ParsleyExtend)._init();break;default:throw new Error(b+"is not a supported Parsley type")}return this.options.multiple&&f.setAttr(this.$element,this.options.namespace,"multiple",this.options.multiple),"undefined"!=typeof c?(this.$element.data("ParsleyFieldMultiple",d),d):(this.$element.data("Parsley",d),d._trigger("init"),d)}};var q=a({}),r=function(){f.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley")},s="parsley:";a.listen=function(a,d){var e;if(r(),"object"==typeof arguments[1]&&"function"==typeof arguments[2]&&(e=arguments[1],d=arguments[2]),"function"!=typeof arguments[1])throw new Error("Wrong parameters");window.Parsley.on(c(a),b(d,e))},a.listenTo=function(a,d,e){if(r(),!(a instanceof n||a instanceof l))throw new Error("Mu
1311st give Parsley instance");if("string"!=typeof d||"function"!=typeof e)throw new Error("Wrong parameters");a.on(c(d),b(e))},a.unsubscribe=function(a,b){if(r(),"string"!=typeof a||"function"!=typeof b)throw new Error("Wrong arguments");window.Parsley.off(c(a),b.parsleyAdaptedCallback)},a.unsubscribeTo=function(a,b){if(r(),!(a instanceof n||a instanceof l))throw new Error("Must give Parsley instance");a.off(c(b))},a.unsubscribeAll=function(b){r(),window.Parsley.off(c(b)),a("form,input,textarea,select").each(function(){var d=a(this).data("Parsley");d&&d.off(c(b))})},a.emit=function(a,b){r();var d=b instanceof n||b instanceof l,e=Array.prototype.slice.call(arguments,d?2:1);e.unshift(c(a)),d||(b=window.Parsley),b.trigger.apply(b,e)},window.ParsleyConfig=window.ParsleyConfig||{},window.ParsleyConfig.i18n=window.ParsleyConfig.i18n||{},window.ParsleyConfig.i18n.en=jQuery.extend(window.ParsleyConfig.i18n.en||{},{defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",number:"This value should be a valid number.",integer:"This value should be a valid integer.",digits:"This value should be digits.",alphanum:"This value should be alphanumeric."},notblank:"This value should not be blank.",required:"This value is required.",pattern:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or fewer.",length:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or fewer.",check:"You must select between %s and %s choices.",equalto:"This value should be the same."}),"undefined"!=typeof window.ParsleyValidator&&window.ParsleyValidator.addCatalog("en",window.ParsleyConfig.i18n.en,!0);var t=a.extend(new h,{$element:a(document),actualizeOptions:null,_resetOptions:null,Factory:p,version:"2.1.3"});return a.extend(n.prototype,h.prototype),a.extend(l.prototype,h.prototype),a.extend(p.prototype,h.prototype),a.fn.parsley=a.fn.psly=function(b){if(this.length>1){var c=[];return this.each(function(){c.push(a(this).parsley(b))}),c}return a(this).length?new p(this,b):void f.warn("You must bind Parsley on an existing element.")},"undefined"==typeof window.ParsleyExtend&&(window.ParsleyExtend={}),t.options=a.extend(f.objectCreate(g),window.ParsleyConfig),window.ParsleyConfig=t.options,window.Parsley=window.psly=t,window.ParsleyUtils=f,window.ParsleyValidator=new j(window.ParsleyConfig.validators,window.ParsleyConfig.i18n),window.ParsleyUI="function"==typeof window.ParsleyConfig.ParsleyUI?(new window.ParsleyConfig.ParsleyUI).listen():(new k).listen(),!1!==window.ParsleyConfig.autoBind&&a(function(){a("[data-parsley-validate]").length&&a("[data-parsley-validate]").parsley()}),window.Parsley}); 1312/*************************************************************** 1313 * Copyright notice 1314 * 1315 * (c) 2012 Alexander Kellner <[email protected]>, in2code 1316 * 1317 * All rights reserved 1318 * 1319 * This script is part of the TYPO3 project. The TYPO3 project is 1320 * free software; you can redistribute it and/or modify 1321 * it under the terms of the GNU General Public License as published by 1322 * the Free Software Foundation; either version 3 of the License, or 1323 * (at your option) any later version. 1324 * 1325 * The GNU General Public License can be found at 1326 * http://www.gnu.org/copyleft/gpl.html. 1327 * 1328 * This script is distributed in the hope that it will be useful, 1329 * but WITHOUT ANY WARRANTY; without even the implied warranty of 1330 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1331 * GNU General Public License for more details. 1332 * 1333 * This copyright notice MUST APPEAR in all copies of the script! 1334 ***************************************************************/ 1335 1336jQuery(document).ready(function($) { 1337 $.fn.powermailTabs = function(options) { 1338 'use strict'; 1339 var $form = jQuery(this); 1340 options = jQuery.extend({ 1341 container: 'fieldset', 1342 header: 'legend', 1343 tabs: true, 1344 navigation: true, 1345 openTabOnError: true, 1346 tabIndex: true, 1347 tabMenuClassName: 'powermail_tabmenu', 1348 tabMenuActiveClassName: 'act' 1349 }, options); 1350 1351 showOnlyFirstFieldset($form, options); 1352 generateTabNavigation($form, options); 1353 generateButtonNavigation($form, options); 1354 cleanAndAddErrorClassToTabs($form, options); 1355 openTabWithError($form, options); 1356 }; 1357 1358 /** 1359 * initial show first fieldset 1360 * 1361 * @param {object} $form Complete form object 1362 * @param {array} options 1363 * @returns {void} 1364 */ 1365 function showOnlyFirstFieldset($form, options) { 1366 hideAllFieldsets($form, options); 1367 $form.find(options.container).first().show(); 1368 } 1369 1370 /** 1371 * Generate Tabs 1372 * 1373 * @param {jQuery} $form Complete form object 1374 * @param {array} options 1375 * @return {void} 1376 */ 1377 function generateTabNavigation($form, options) { 1378 if (!options.tabs) { 1379 return; 1380 } 1381 1382 // generate menu 1383 var $tabMenu = $('<ul />', { 1384 'class': options.tabMenuClassName 1385 }).insertBefore( 1386 $form.children(options.container).filter(':first') 1387 ); 1388 1389 // all containers 1390 $form.children(options.container).each(function(i, $fieldset) { 1391 //tab_menu 1392 var li = $('<li/>') 1393 .html($(this).children(options.header).html()) 1394 .addClass((i==0) ? options.tabMenuActiveClassName : '') 1395 .addClass('item' + i) 1396 .on('click keypress', { 1397 container: $form.children(options.container), 1398 fieldset: $($fieldset) 1399 }, function() { 1400 var $listItem = $(this); 1401 var indexTab = $listItem.parent().children().index($listItem); 1402 showTab($form, options, $listItem, indexTab); 1403 }); 1404 if (options.tabIndex) { 1405 li.prop('tabindex', i); 1406 } 1407 $tabMenu.append(li); 1408 }); 1409 } 1410 1411 /** 1412 * Generate Button Navigation 1413 * 1414 * @param {object} $form Complete form object 1415 * @param {array} options 1416 * @return {void} 1417 */ 1418 function generateButtonNavigation($form, options) { 1419 if (!options.navigation) { 1420 return; 1421 } 1422 1423 // buttons 1424 $form.children(options.container).each(function(i) {
1425 var navigationContainer = $('<div />') 1426 .addClass('powermail_fieldwrap') 1427 .addClass('powermail_tab_navigation') 1428 .appendTo($(this)); 1429 if (i > 0) { 1430 navigationContainer.append(createPreviousButton($form, options)); 1431 } 1432 if (i < ($form.children(options.container).length - 1)) { 1433 navigationContainer.append(createNextButton($form, options)); 1434 } 1435 }); 1436 } 1437 1438 /** 1439 * Add error class to tab and show first if Parsley.js is active 1440 * 1441 * @param {object} $form Complete form object 1442 * @param {array} options 1443 * @return {void} 1444 */ 1445 function cleanAndAddErrorClassToTabs($form, options) { 1446 if ($.fn.parsley && $form.data('parsley-validate') === 'data-parsley-validate') { 1447 $form.parsley().subscribe('parsley:field:validated', function() { 1448 removeErrorClassFromTabs($form, options); 1449 addErrorClassToTabs($form, options); 1450 }); 1451 } 1452 } 1453 1454 /** 1455 * Open Tab with error 1456 * 1457 * @param {object} $form Complete form object 1458 * @param {array} options 1459 * @return {void} 1460 */ 1461 function openTabWithError($form, options) { 1462 if (options.openTabOnError) { 1463 $.listen('parsley:field:error', function() { 1464 setTimeout(function() { 1465 $form.find('.' + options.tabMenuClassName + ' > .parsley-error:first').click(); 1466 }, 50); 1467 }); 1468 } 1469 } 1470 1471 /** 1472 ************* Internal ************* 1473 */ 1474 1475 /** 1476 * Show Tab by index 1477 * 1478 * @param {object} $form Complete form object 1479 * @param {array} options 1480 * @param {object} $listItem 1481 * @param {int} clickedIndex 1482 * @return {void} 1483 */ 1484 function showTab($form, options, $listItem, clickedIndex) { 1485 $activeTab = getActiveTabMenuListItem($form, options); 1486 $activeTab.removeClass(options.tabMenuActiveClassName); 1487 $listItem.addClass(options.tabMenuActiveClassName); 1488 hideAllFieldsets($form, options); 1489 $('.powermail_fieldset', $form).slice(clickedIndex, clickedIndex + 1).show(); 1490 } 1491 1492 /** 1493 * Hide all fieldsets 1494 * 1495 * @param {object} $form Complete form object 1496 * @param {array} options 1497 * @return {void} 1498 */ 1499 function hideAllFieldsets($form, options) { 1500 $form.children(options.container).hide(); 1501 } 1502 1503 /** 1504 * Create next button 1505 * 1506 * @param {object} $form Complete form object 1507 * @param {array} options 1508 * @return {object} 1509 */ 1510 function createPreviousButton($form, options) { 1511 return $('<a />') 1512 .prop('href', '#') 1513 .addClass('powermail_tab_navigation_previous') 1514 .html('<') 1515 .click(function(e) { 1516 e.preventDefault(); 1517 showPreviousTab($form, options); 1518 }); 1519 } 1520 1521 /** 1522 * Create next button 1523 * 1524 * @param {object} $form Complete form object 1525 * @param {array} options 1526 * @return {object} 1527 */ 1528 function createNextButton($form, options) { 1529 return $('<a />') 1530 .prop('href', '#') 1531 .addClass('powermail_tab_navigation_next') 1532 .html('>') 1533 .click(function(e) { 1534 e.preventDefault(); 1535 showNextTab($form, options); 1536 }); 1537 } 1538 1539 /** 1540 * Show next Tab 1541 * 1542 * @param {object} $form Complete form object 1543 * @param {array} options 1544 * @return {void} 1545 */ 1546 function showNextTab($form, options) { 1547 var currentActiveTabIndex = getIndexOfCurrentActiveTab($form, options); 1548 $activeTab = getActiveTabMenuListItem($form, options); 1549 $activeTab.removeClass(options.tabMenuActiveClassName).next().addClass(options.tabMenuActiveClassName); 1550 showFieldsetByIndex($form, options, currentActiveTabIndex + 1); 1551 } 1552 1553 /** 1554 * Show previous Tab 1555 * 1556 * @param {object} $form Complete form object 1557 * @param {array} options 1558 * @return {void} 1559 */ 1560 function showPreviousTab($form, options) { 1561 var currentActiveTabIndex = getIndexOfCurrentActiveTab($form, options); 1562 $activeTab = getActiveTabMenuListItem($form, options); 1563 $activeTab.removeClass(options.tabMenuActiveClassName).prev().addClass(options.tabMenuActiveClassName); 1564 showFieldsetByIndex($form, options, currentActiveTabIndex - 1); 1565 } 1566 1567 /** 1568 * Show a powermail fieldset by given index 1569 * 1570 * @param {object} $form Complete form object 1571 * @param {array} options 1572 * @param {int} index 1573 * @return {void} 1574 */ 1575 function showFieldsetByIndex($form, options, index) { 1576 hideAllFieldsets($form, options); 1577 $form.find('.powermail_fieldset').slice(index, index + 1).show(); 1578 } 1579 1580 /** 1581 * Get index of current active tab 1582 * 1583 * @param {object} $form Complete form object 1584 * @param {array} options 1585 * @returns {int} 1586 */ 1587 function getIndexOfCurrentActiveTab($form, options) { 1588 var $listItems = getCurrentTabMenuListItems($form, options); 1589 var currentActiveTabIndex = $listItems.index(getActiveTabMenuListItem($form, options)); 1590 return parseInt(currentActiveTabIndex); 1591 } 1592 1593 /** 1594 * Get all list items from tabmenu 1595 * 1596 * @param {object} $form Complete form object 1597 * @param {array} options 1598 * @returns {jQuery} 1599 */ 1600 function getCurrentTabMenuListItems($form, options) { 1601 return $form.find('.' + options.tabMenuClassName + ' > li'); 1602 } 1603 1604 /** 1605 * Get active list item in tabmenu 1606 * 1607 * @param {object} $form Complete form object 1608 * @param {array} options 1609 * @returns {jQuery} 1610 */ 1611 function getActiveTabMenuListItem($form, options) { 1612 var $listItems = getCurrentTabMenuListItems($form, options); 1613 return $listItems.filter('.' + options.tabMenuActiveClassName); 1614 } 1615 1616 /** 1617 * Remove error classes from tab navigation 1618 * 1619 * @param {object} $form Complete form object 1620 * @param {array} options 1621 * @returns {void} 1622 */ 1623 function removeErrorClassFromTabs($form, options) { 1624 var $tabMenuListItems = getCurrentTabMenuListItems($form, options); 1625 $tabMenuListItems.removeClass('parsley-error'); 1626 } 1627 1628 /** 1629 * Add error classes to tab navigation 1630 * 1631 * @param {object} $form Complete form object 1632 * @param {array} options 1633 * @returns {void} 1634 */ 1635 function addErrorClassToTabs($form, options) { 1636 if (!$form.parsley().isValid()) { 1637 // iterate through all fields with errors 1638 $form.find('.parsley-error').each(function() { 1639 var errorIndex = $form.find('.powermail_fieldset').index($(this).closest('.powermail_fieldset')); 1640 var $tabMenuListItems = getCurrentTabMenuListItems($form, options); 1641 var $tabWithError = $tabMenuListItems.slice(errorIndex, errorIndex + 1); 1642 $tabWithError.addClass('parsley-error'); 1643 }); 1644 } 1645 } 1646}); 1647 1648/** 1649 * Powermail functions 1650 * 1651 * @params {jQuery} $ 1652 * @class PowermailForm 1653 */ 1654function PowermailForm($) { 1655 'use strict'; 1656 1657 /** 1658 * This class 1659 * 1660 * @type {PowermailForm} 1661 */ 1662 var that = this; 1663 1664 /** 1665 * Initialize 1666 * 1667 * @returns {void} 1668 */ 1669 this.initialize = function() { 1670 that.addTabsListener(); 1671 that.addAjaxFormSubmitListener(); 1672 that.getLocationAndWrite(); 1673 that.addDatePicker(); 1674 that.hidePasswords(); 1675 that.addResetListener(); 1676 that.deleteAllFilesListener(); 1677 that.uploadValidationListener(); 1678 }; 1679 1680 /** 1681 * Add tabs listener 1682 * 1683 * @returns {void} 1684 */ 1685 this.addTabsListener = function() { 1686 if ($.fn.powermailTabs) { 1687 $('.powermail_morestep').each(function() { 1688 $(this).powermailTabs(); 1689 }); 1690 } 1691 }; 1692 1693 /** 1694 * Add Ajax form submit listener 1695 * 1696 * @returns {void} 1697 */ 1698 this.addAjaxFormSubmitListener = function() { 1699 if ($('form[data-powermail-ajax]').length) { 1700 that.ajaxFormSubmit(); 1701 } 1702 }; 1703 1704 /** 1705 * Getting the Location by the browser and write to inputform as address 1706 * 1707 * @return {void} 1708 */ 1709 this.getLocationAndWrite = function() { 1710 if ($('.powermail_fieldwrap_location input').length && navigator.geolocation) { 1711 navigator.geolocation.getCurrentPosition(function(position) { 1712 var lat = position.coords.latitude; 1713 var lng = position.coords.longitude; 1714 var url = that.getBaseUrl() + '/index.php' + '?eID=' + 'powermailEidGetLocation'; 1715 jQuery.ajax({ 1716 url: url, 1717 data: 'lat=' + lat + '&lng=' + lng, 1718 cache: false, 1719 beforeSend: function() { 1720 $('body').css('cursor', 'wait'); 1721 }, 1722 complete: function() { 1723 $('body').css('cursor', 'default'); 1724 }, 1725 success: function(data) { 1726 if (data) { 1727 $('.powermail_fieldwrap_location input').val(data); 1728 } 1729 } 1730 }); 1731 }); 1732 } 1733 }; 1734 1735 /** 1736 * Add datepicker to date fields 1737 * 1738 * @returns {void} 1739 */ 1740 this.addDatePicker = function() { 1741 if ($.fn.datetimepicker) { 1742 $('.powermail_date').each(function() { 1743 var $this = $(this); 1744 // stop javascript datepicker, if browser supports type="date" or "datetime-local" or "time" 1745 if ($this.prop('type') === 'date' || $this.prop('type') === 'datetime-local' || $this.prop('type') === 'time') { 1746 if ($this.data('datepicker-force')) { 1747 // rewrite input type 1748 $this.prop('type', 'text'); 1749 } else {
1750 // get date in format Y-m-d H:i for html5 date fields 1751 if ($(this).data('date-value')) { 1752 var prefillDate = that.getDatetimeForDateFields($(this).data('date-value'), $(this).data('datepicker-format'), $this.prop('type')); 1753 if (prefillDate !== null) { 1754 $(this).val(prefillDate); 1755 } 1756 } 1757 1758 // stop js datepicker 1759 return; 1760 } 1761 } 1762 1763 var datepickerStatus = true; 1764 var timepickerStatus = true; 1765 if ($this.data('datepicker-settings') === 'date') { 1766 timepickerStatus = false; 1767 } else if ($this.data('datepicker-settings') === 'time') { 1768 datepickerStatus = false; 1769 } 1770 1771 // create datepicker 1772 $this.datetimepicker({ 1773 format: $this.data('datepicker-format'), 1774 timepicker: timepickerStatus, 1775 datepicker: datepickerStatus, 1776 lang: 'en', 1777 i18n:{ 1778 en:{ 1779 months: $this.data('datepicker-months').split(','), 1780 dayOfWeek: $this.data('datepicker-days').split(',') 1781 } 1782 } 1783 }); 1784 }); 1785 } 1786 }; 1787 1788 /** 1789 * Simply change value of password fields 1790 * 1791 * @returns {void} 1792 */ 1793 this.hidePasswords = function() { 1794 $('.powermail_all_type_password.powermail_all_value').html('********'); 1795 }; 1796 1797 /** 1798 * Add validation reseter on click on reset button 1799 * 1800 * @returns {void} 1801 */ 1802 this.addResetListener = function() { 1803 if ($.fn.parsley) { 1804 $('.powermail_reset').on('click', '', function() { 1805 $('form[data-parsley-validate="data-parsley-validate"]').parsley().reset(); 1806 }); 1807 } 1808 }; 1809 1810 /** 1811 * Add validation for upload fields 1812 * 1813 * @returns {void} 1814 */ 1815 this.uploadValidationListener = function() { 1816 if (window.ParsleyValidator) { 1817 that.uploadSizeValidatorListener(); 1818 that.uploadExtensionValidatorListener(); 1819 } 1820 }; 1821 1822 /** 1823 * ************ INTERNAL ************* 1824 */ 1825 1826 /** 1827 * Allow AJAX Submit for powermail 1828 * 1829 * @returns {void} 1830 */ 1831 this.ajaxFormSubmit = function() { 1832 var regularSubmitOnAjax = false; 1833 var redirectUri; 1834 1835 // submit is called after parsley and html5 validation - so we don't have to check for errors 1836 $(document).on('submit', 'form[data-powermail-ajax]', function(e) { 1837 var $this = $(this); 1838 if ($this.data('powermail-ajax-uri')) { 1839 redirectUri = $this.data('powermail-ajax-uri'); 1840 } 1841 var formUid = $this.data('powermail-form'); 1842 1843 if (!regularSubmitOnAjax) { 1844 $.ajax({ 1845 type: 'POST', 1846 url: $this.prop('action'), 1847 data: new FormData($this.get(0)), 1848 contentType: false, 1849 processData: false, 1850 beforeSend: function() { 1851 $('.powermail_submit', $this).parent().append(that.getProgressbar()); 1852 $('.powermail_confirmation_submit, .powermail_confirmation_form', $this).closest('.powermail_confirmation').append(that.getProgressbar()); 1853 }, 1854 complete: function() { 1855 // remove progressbar 1856 $('.powermail_fieldwrap_submit', $this).find('.powermail_progressbar').remove(); 1857 that.deleteAllFilesListener(); 1858 }, 1859 success: function(data) { 1860 var html = $('*[data-powermail-form="' + formUid + '"]:first', data); 1861 if (html.length) { 1862 $('*[data-powermail-form="' + formUid + '"]:first').closest('.tx-powermail').html(html); 1863 // fire tabs and parsley again 1864 if ($.fn.powermailTabs) { 1865 $('.powermail_morestep').powermailTabs(); 1866 } 1867 if ($.fn.parsley) { 1868 $('form[data-parsley-validate="data-parsley-validate"]').parsley(); 1869 } 1870 that.reloadCaptchaImages(); 1871 } else { 1872 // no form markup found try to redirect via javascript 1873 if (redirectUri) { 1874 window.location = redirectUri; 1875 } else { 1876 // fallback if no location found (but will effect 2x submit) 1877 $this.submit(); 1878 } 1879 regularSubmitOnAjax = true; 1880 } 1881 } 1882 }); 1883 1884 e.preventDefault(); 1885 } 1886 }); 1887 }; 1888 1889 /** 1890 * Add eventhandler for deleting all files button 1891 * 1892 * @returns {void} 1893 */ 1894 this.deleteAllFilesListener = function() { 1895 $('.powermail_fieldwrap_file_inner').find('.deleteAllFiles').each(function() { 1896 // initially hide upload fields 1897 that.disableUploadField($(this).closest('.powermail_fieldwrap_file_inner').find('input[type="file"]')); 1898 }); 1899 $('.deleteAllFiles').click(function() { 1900 that.enableUploadField($(this).closest('.powermail_fieldwrap_file_inner').children('input[type="hidden"]')); 1901 $(this).closest('ul').fadeOut(function() { 1902 $(this).remove(); 1903 }); 1904 }); 1905 }; 1906 1907 /** 1908 * Disable upload field 1909 * 1910 * @param {jQuery} $element 1911 * @returns {void} 1912 */ 1913 this.disableUploadField = function($element) { 1914 $element.prop('disabled', 'disabled').addClass('hide').prop('type', 'hidden'); 1915 }; 1916 1917 /** 1918 * Enable upload field 1919 * 1920 * @param {jQuery} $element 1921 * @returns {void} 1922 */ 1923 this.enableUploadField = function($element) { 1924 $element.prop('disabled', false).removeClass('hide').prop('type', 'f
1924ile'); 1925 }; 1926 1927 /** 1928 * Reload captcha images 1929 * 1930 * @returns {void} 1931 */ 1932 this.reloadCaptchaImages = function() { 1933 $('img.powermail_captchaimage').each(function() { 1934 var source = that.getUriWithoutGetParam($(this).prop('src')); 1935 $(this).prop('src', source + '?hash=' + that.getRandomString(5)); 1936 }); 1937 }; 1938 1939 /** 1940 * Get uri without get params 1941 * 1942 * @param {string} uri 1943 * @returns {string} 1944 */ 1945 this.getUriWithoutGetParam = function(uri) { 1946 var parts = uri.split('?'); 1947 return parts[0]; 1948 }; 1949 1950 /** 1951 * Get random string 1952 * 1953 * @param {int} length 1954 * @returns {string} 1955 */ 1956 this.getRandomString = function(length) { 1957 var text = ''; 1958 var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 1959 for (var i=0; i < length; i++) { 1960 text += possible.charAt(Math.floor(Math.random() * possible.length)); 1961 } 1962 return text; 1963 }; 1964 1965 /** 1966 * Convert date format for html5 date fields 1967 * 31.08.2014 => 2014-08-31 1968 * 1969 * @param {string} value 1970 * @param {string} format 1971 * @param {string} type 1972 * @returns {string|null} 1973 */ 1974 this.getDatetimeForDateFields = function(value, format, type) { 1975 var formatDate = Date.parseDate(value, format); 1976 if (formatDate === null) { 1977 return null; 1978 } 1979 var date = new Date(formatDate); 1980 var valueDate = date.getFullYear() + '-'; 1981 valueDate += ('0' + (date.getMonth() + 1)).slice(-2) + '-'; 1982 valueDate += ('0' + date.getDate()).slice(-2); 1983 var valueTime = ('0' + date.getHours()).slice(-2) + ':' + ('0' + date.getMinutes()).slice(-2); 1984 var valueDateTime = valueDate + 'T' + valueTime; 1985 1986 if (type === 'date') { 1987 return valueDate; 1988 } 1989 if (type === 'datetime-local') { 1990 return valueDateTime; 1991 } 1992 if (type === 'time') { 1993 return valueTime; 1994 } 1995 return null; 1996 }; 1997 1998 /** 1999 * Get markup for progressbar 2000 * div.powermail_progressbar>div.powermail_progress>div.powermail_progess_inner 2001 * 2002 * @returns {jQuery} 2003 */ 2004 this.getProgressbar = function() { 2005 return $('<div />').addClass('powermail_progressbar').html( 2006 $('<div />').addClass('powermail_progress').html( 2007 $('<div />').addClass('powermail_progess_inner') 2008 ) 2009 ); 2010 }; 2011 2012 /** 2013 * Get maximum filesize of files in multiple upload field 2014 * 2015 * @param {jQuery} $field 2016 * @returns {int} 2017 */ 2018 this.getMaxFileSize = function($field) { 2019 var field = $field.get(0); 2020 var size = 0; 2021 for (var i = 0; i < field.files.length; i++) { 2022 var file = field.files[i]; 2023 if (file.size > size) { 2024 size = file.size; 2025 } 2026 } 2027 return parseInt(size); 2028 }; 2029 2030 /** 2031 * Filesize check for upload fields 2032 * 2033 * @returns {void} 2034 */ 2035 this.uploadSizeValidatorListener = function() { 2036 window.ParsleyValidator 2037 .addValidator('powermailfilesize', function(value, requirement) { 2038 if (requirement.indexOf(',') !== -1) { 2039 var requirements = requirement.split(','); 2040 var maxUploadSize = parseInt(requirements[0]); 2041 var $this = $('*[name="tx_powermail_pi1[field][' + requirements[1] + '][]"]'); 2042 if ($this.length) { 2043 if (that.getMaxFileSize($this) > maxUploadSize) { 2044 return false; 2045 } 2046 } 2047 } 2048 2049 // pass test if problems 2050 return true; 2051 }, 32) 2052 .addMessage('en', 'powermailfilesize', 'Error'); 2053 }; 2054 2055 /** 2056 * File extension check for upload fields 2057 * 2058 * @returns {void} 2059 */ 2060 this.uploadExtensionValidatorListener = function() { 2061 window.ParsleyValidator 2062 .addValidator('powermailfileextensions', function(value, requirement) { 2063 var $this = $('*[name="tx_powermail_pi1[field][' + requirement + '][]"]'); 2064 if ($this.length) { 2065 return that.isFileExtensionInList(that.getExtensionFromFileName(value), $this.prop('accept')); 2066 } 2067 2068 // pass test if problems 2069 return true; 2070 }, 32) 2071 .addMessage('en', 'powermailfileextensions', 'Error'); 2072 }; 2073 2074 /** 2075 * Check if fileextension is allowed in dotted list 2076 * "jpg" in ".jpg,.jpeg" => true 2077 * "jpg" in ".gif,.png" => false 2078 * 2079 * @param {string} extension 2080 * @param {string} list 2081 * @returns {boolean} 2082 */ 2083 this.isFileExtensionInList = function(extension, list) { 2084 return list.indexOf('.' + extension) !== -1; 2085 }; 2086 2087 /** 2088 * Get extension from filename 2089 * image.jpg => jpg 2090 * 2091 * @param {string} fileName 2092 * @returns {string} 2093 */ 2094 this.getExtensionFromFileName = function(fileName) { 2095 return fileName.split('.').pop(); 2096 }; 2097 2098 /** 2099 * Return BaseUrl as prefix 2100 * 2101 * @return {string} Base Url 2102 */ 2103 this.getBaseUrl = function() { 2104 var baseurl; 2105 if ($('base').length > 0) { 2106 baseurl = jQuery('base').prop('href'); 2107 } else { 2108 if (window.location.protocol != "https:") { 2109 baseurl = 'http://' + window.location.hostname; 2110 } else { 2111 baseurl = 'https://' + window.location.hostname; 2112 } 2113 } 2114 return baseurl; 2115 } 2116} 2117 2118jQuery(document).ready(function($) { 2119 'use strict'; 2120 var PowermailForm = new window.PowermailForm($); 2121 PowermailForm.initialize(); 2122}); 2123 2124 2125/*! 2126 * shariff - v1.21.0 - 06.11.2015 2127 * https://github.com/heiseonline/shariff 2128 * Copyright (c) 2015 Ines Pauer, Philipp Busse, Sebastian Hilbig, Erich Kramer, Deniz Sesli 2129 * Licensed under the MIT license 2130 */ 2131 2132 2133(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 2134(function (global){ 2135!function(e){function o(e){throw RangeError(T[e])}function n(e,o){for(var n=e.length,r=[];n--;)r[n]=o(e[n]);return r}function r(e,o){var r=e.split("@"),t="";r.length>1&&(t=r[0]+"@",e=r[1]),e=e.replace(S,".");var u=e.split("."),i=n(u,o).join(".");return t+i}function t(e){for(var o,n,r=[],t=0,u=e.length;u>t;)o=e.charCodeAt(t++),o>=55296&&56319>=o&&u>t?(n=e.charCodeAt(t++),56320==(64512&n)?r.push(((1023&o)<<10)+(1023&n)+65536):(r.push(o),t--)):r.push(o);return r}function u(e){return n(e,function(e){var o="";return e>65535&&(e-=65536,o+=P(e>>>10&1023|55296),e=56320|1023&e),o+=P(e)}).join("")}function i(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:b}function f(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function c(e,o,n){var r=0;for(e=n?M(e/j):e>>1,e+=M(e/o);e>L*C>>1;r+=b)e=M(e/L);return M(r+(L+1)*e/(e+m))}function l(e){var n,r,t,f,l,s,d,a,p,h,v=[],g=e.length,w=0,m=I,j=A;for(r=e.lastIndexOf(E),0>r&&(r=0),t=0;r>t;++t)e.charCodeAt(t)>=128&&o("not-basic"),v.push(e.charCodeAt(t));for(f=r>0?r+1:0;g>f;){for(l=w,s=1,d=b;f>=g&&o("invalid-input"),a=i(e.charCodeAt(f++)),(a>=b||a>M((x-w)/s))&&o("overflow"),w+=a*s,p=j>=d?y:d>=j+C?C:d-j,!(p>a);d+=b)h=b-p,s>M(x/h)&&o("overflow"),s*=h;n=v.length+1,j=c(w-l,n,0==l),M(w/n)>x-m&&o("overflow"),m+=M(w/n),w%=n,v.splice(w++,0,m)}return u(v)}function s(e){var n,r,u,i,l,s,d,a,p,h,v,g,w,m,j,F=[];for(e=t(e),g=e.length,n=I,r=0,l=A,s=0;g>s;++s)v=e[s],128>v&&F.push(P(v));for(u=i=F.length,i&&F.push(E);g>u;){for(d=x,s=0;g>s;++s)v=e[s],v>=n&&d>v&&(d=v);for(w=u+1,d-n>M((x-r)/w)&&o("overflow"),r+=(d-n)*w,n=d,s=0;g>s;++s)if(v=e[s],n>v&&++r>x&&o("overflow"),v==n){for(a=r,p=b;h=l>=p?y:p>=l+C?C:p-l,!(h>a);p+=b)j=a-h,m=b-h,F.push(P(f(h+j%m,0))),a=M(j/m);F.push(P(f(a,0))),l=c(r,w,u==i),r=0,++u}++r,++n}return F.join("")}function d(e){return r(e,function(e){return F.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return O.test(e)?"xn--"+s(e):e})}var p="object"==typeof exports&&exports&&!exports.nodeType&&exports,h="object"==typeof module&&module&&!module.nodeType&&module,v="object"==typeof global&&global;(v.global===v||v.window===v||v.self===v)&&(e=v);var g,w,x=2147483647,b=36,y=1,C=26,m=38,j=700,A=72,I=128,E="-",F=/^xn--/,O=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >
vendor: 10,341 bytes, lines 2135-2148
2135= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=b-y,M=Math.floor,P=String.fromCharCode;if(g={version:"1.3.2",ucs2:{decode:t,encode:u},decode:l,encode:s,toASCII:a,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(p&&h)if(module.exports==p)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else e.punycode=g}(this); 2136 2137}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 2138},{}],2:[function(require,module,exports){ 2139"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;p>y;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)}; 2140 2141},{}],3:[function(require,module,exports){ 2142"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?map(r[n],function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e}; 2143 2144},{}],4:[function(require,module,exports){ 2145"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode"); 2146 2147},{"./decode":2,"./encode":3}],5:[function(require,module,exports){ 2148function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function urlParse(t,s,e){if(t&&isObject(t)&&t instanceof Url)return t;var h=new Url;return h.parse(t,s,e),h}function urlFormat(t){return isString(t)&&(t=urlParse(t)),t instanceof Url?t.format():Url.prototype.format.call(t)}function urlResolve(t,s){return urlParse(t,!1,!0).resolve(s)}function urlResolveObject(t,s){return t?urlParse(t,!1,!0).resolveObject(s):s}function isString(t){return"string"==typeof t}function isObject(t){return"object"==typeof t&&null!==t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}var punycode=require("punycode");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");Url.prototype.parse=function(t,s,e){if(!isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t;h=h.trim();var r=protocolPattern.exec(h);if(r){r=r[0];var o=r.toLowerCase();this.protocol=o,h=h.substr(r.length)}if(e||r||h.match(/^\/\/[^@\/]+@[^@\/]+/)){var a="//"===h.substr(0,2);!a||r&&hostlessProtocol[r]||(h=h.substr(2),this.slashes=!0)}if(!hostlessProtocol[r]&&(a||r&&!slashedProtocol[r])){for(var n=-1,i=0;i<hostEndingChars.length;i++){var l=h.indexOf(hostEndingChars[i]);-1!==l&&(-1===n||n>l)&&(n=l)}var c,u;u=-1===n?h.lastIndexOf("@"):h.lastIndexOf("@",n),-1!==u&&(c=h.slice(0,u),h=h.slice(u+1),this.auth=decodeURIComponent(c)),n=-1;for(var i=0;i<nonHostChars.length;i++){var l=h.indexOf(nonHostChars[i]);-1!==l&&(-1===n||n>l)&&(n=l)}-1===n&&(n=h.length),this.host=h.slice(0,n),h=h.slice(n),this.parseHost(),this.hostname=this.hostname||"";var p="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!p)for(var f=this.hostname.split(/\./),i=0,m=f.length;m>i;i++){var v=f[i];if(v&&!v.match(hostnamePartPattern)){for(var g="",y=0,d=v.length;d>y;y++)g+=v.charCodeAt(y)>127?"x":v[y];if(!g.match(hostnamePartPattern)){var P=f.slice(0,i),b=f.slice(i+1),j=v.match(hostnamePartStart);j&&(P.push(j[1]),b.unshift(j[2])),b.length&&(h="/"+b.join(".")+h),this.hostname=P.join(".");break}}}if(this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),!p){for(var O=this.hostname.split("."),q=[],i=0;i<O.length;++i){var x=O[i];q.push(x.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(x):x)}this.hostname=q.join(".")}var U=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+U,this.href+=this.host,p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!unsafeProtocol[o])for(var i=0,m=autoEscape.length;m>i;i++){var A=autoEscape[i],E=encodeURIComponent(A);E===A&&(E=escape(A)),h=h.split(A).join(E)}var w=h.indexOf("#");-1!==w&&(this.hash=h.substr(w),h=h.slice(0,w));var R=h.indexOf("?");if(-1!==R?(this.search=h.substr(R),this.query=h.substr(R+1),s&&(this.query=querystring.parse(this.query)),h=h.slice(0,R)):s&&(this.search="",this.query={}),h&&(this.pathname=h),slashedProtocol[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var U=this.pathname||"",x=this.search||"";this.path=U+x}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var s=this.protocol||"",e=this.pathname||"",h=this.hash||"",r=!1,o="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&isObject(this.query)&&Object.keys(this.query).length&&(o=querystring.stringify(this.query));var a=this.search||o&&"?"+o||"";return s&&":"!==s.substr(-1)&&(s+=":"),this.slashes||(!s||slashedProtocol[s])&&r!==!1?(r="//"+(r||""),e&&"/"!==e.charAt(0)&&(e="/"+e)):r||(r=""),h&&"#"!==h.charAt(0)&&(h="#"+h),a&&"?"!==a.charAt(0)&&(a="?"+a),e=e.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),s+r+e+a+h},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if(isString(t)){var s=new Url;s.parse(t,!1,!0),t=s}var e=new Url;if(Object.keys(this).forEach(function(t){e[t]=this[t]},this),e.hash=t.hash,""===t.href)return e.href=e.format(),e;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(s){"protocol"!==s&&(e[s]=t[s])}),slashedProtocol[e.protocol]&&e.hostname&&!e.pathname&&(e.path=e.pathname="/"),e.href=e.format(),e;if(t.protocol&&t.protocol!==e.protocol){if(!slashedProtocol[t.protocol])return Object.keys(t).forEach(function(s){e[s]=t[s]}),e.href=e.format(),e;if(e.protocol=t.protocol,t.host||hostlessProtocol[t.protocol])e.pathname=t.pathname;else{for(var h=(t.pathname||"").split("/");h.length&&!(t.host=h.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==h[0]&&h.unshift(""),h.length<2&&h.unshift(""),e.pathname=h.join("/")}if(e.search=t.search,e.query=t.query,e.host=t.host||"",e.auth=t.auth,e.hostname=t.hostname||t.host,e.port=t.port,e.pathname||e.search){var r=e.pathname||"",o=e.search||"";e.path=r+o}return e.slashes=e.slashes||t.slashes,e.href=e.format(),e}var a=e.pathname&&"/"===e.pathname.charAt(0),n=t.host||t.pathname&&"/"===t.pathname.charAt(0),i=n||a||e.host&&t.pathname,l=i,c=e.pathname&&e.pathname.split("/")||[],h=t.pathname&&t.pathname.split("/")||[],u=e.protocol&&!slashedProtocol[e.protocol];if(u&&(e.hostname="",e.port=null,e.host&&(""===c[0]?c[0]=e.host:c.unshift(e.host)),e.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===h[0]?h[0]=t.host:h.unshift(t.host)),t.host=null),i=i&&(""===h[0]||""===c[0])),n)e.host=t.host||""===t.host?t.host:e.host,e.hostname=t.hostname||""===t.hostname?t.hostname:e.hostname,e.search=t.search,e.query=t.query,c=h;else if(h.length)c||(c=[]),c.pop(),c=c.concat(h),e.search=t.search,e.query=t.query;else if(!isNullOrUndefined(t.search)){if(u){e.hostname=e.host=c.shift();var p=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;p&&(e.auth=p.shift(),e.host=e.hostname=p.shift())}return e.search=t.search,e.query=t.query,isNull(e.pathname)&&isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!c.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var f=c.slice(-1)[0],m=(e.host||t.host)&&("."===f||".."===f)||""===f,v=0,g=c.length;g>=0;g--)f=c[g],"."==f?c.splice(g,1):".."===f?(c.splice(g,1),v++):v&&(c.splice(g,1),v--);if(!i&&!l)for(;v--;v)c.unshift("..");!i||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),m&&"/"!==c.join("/").substr(-1)&&c.push("");var y=""===c[0]||c[0]&&"/"===c[0].charAt(0);if(u){e.hostname=e.host=y?"":c.length?c.shift():"";var p=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;p&&(e.auth=p.shift(),e.host=e.hostname=p.shift())}return i=i||e.host&&c.length,i&&!y&&c.unshift(""),c.length?e.pathname=c.join("/"):(e.pathname=null,e.path=null),isNull(e.pathname)&&isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},Url.prototype.parseHost=function(){var t=this.host,s=portPattern.exec(t);
2148s&&(s=s[0],":"!==s&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)}; 2149 2150},{"punycode":1,"querystring":4}],6:[function(require,module,exports){ 2151"use strict";module.exports=function(d){var e=encodeURIComponent(d.getURL());return{popup:!0,shareText:{bg:"cподелÑне",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"å ±æ",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"partajeazÄ",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"addthis",faName:"fa-plus",title:{bg:"Сподели в AddThis",da:"Del pÃ¥ AddThis",de:"Bei AddThis teilen",en:"Share on AddThis",es:"Compartir en AddThis",fi:"Jaa AddThisissä",fr:"Partager sur AddThis",hr:"Podijelite na AddThis",hu:"Megosztás AddThisen",it:"Condividi su AddThis",ja:"AddThisä¸ã§å ±æ",ko:"AddThisìì ê³µì í기",nl:"Delen op AddThis",no:"Del pÃ¥ AddThis",pl:"UdostÄpnij przez AddThis",pt:"Compartilhar no AddThis",ro:"PartajeazÄ pe AddThis",ru:"ÐоделиÑÑÑÑ Ð½Ð° AddThis",sk:"ZdieľaÅ¥ na AddThis",sl:"Deli na AddThis",sr:"Podeli na AddThis",sv:"Dela pÃ¥ AddThis",tr:"AddThis'ta paylaÅ",zh:"å¨AddThisä¸å享"},shareUrl:"http://api.addthis.com/oexchange/0.8/offer?url="+e+d.getReferrerTrack()}}; 2152 2153},{}],7:[function(require,module,exports){ 2154"use strict";var url=require("url");module.exports=function(e){var r=url.parse("https://sharetodiaspora.github.io/",!0);return r.query.url=e.getURL(),r.query.title=e.getTitle()||e.getMeta("DC.title"),r.protocol="https",delete r.search,{popup:!0,shareText:{de:"teilen",en:"share"},name:"diaspora",faName:"fa-asterisk",title:{de:"Bei Diaspora teilen",en:"Share on Diaspora"},shareUrl:url.format(r)+e.getReferrerTrack()}}; 2155 2156},{"url":5}],8:[function(require,module,exports){ 2157"use strict";module.exports=function(e){var o=encodeURIComponent(e.getURL());return{popup:!0,shareText:{bg:"cподелÑне",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"å ±æ",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"partajeazÄ",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"facebook",faName:"fa-facebook",title:{bg:"Сподели вÑв Facebook",da:"Del pÃ¥ Facebook",de:"Bei Facebook teilen",en:"Share on Facebook",es:"Compartir en Facebook",fi:"Jaa Facebookissa",fr:"Partager sur Facebook",hr:"Podijelite na Facebooku",hu:"Megosztás Facebookon",it:"Condividi su Facebook",ja:"ãã§ã¤ã¹ããã¯ä¸ã§å ±æ",ko:"íì´ì¤ë¶ìì ê³µì í기",nl:"Delen op Facebook",no:"Del pÃ¥ Facebook",pl:"UdostÄpnij na Facebooku",pt:"Compartilhar no Facebook",ro:"PartajeazÄ pe Facebook",ru:"ÐоделиÑÑÑÑ Ð½Ð° Facebook",sk:"ZdieľaÅ¥ na Facebooku",sl:"Deli na Facebooku",sr:"Podeli na Facebook-u",sv:"Dela pÃ¥ Facebook",tr:"Facebook'ta paylaÅ",zh:"å¨Facebookä¸å享"},shareUrl:"https://www.facebook.com/sharer/sharer.php?u="+o+e.getReferrerTrack()}}; 2158 2159},{}],9:[function(require,module,exports){ 2160"use strict";module.exports=function(t){var e=encodeURIComponent(t.getURL()),o=t.getMeta("DC.title"),r=t.getMeta("DC.creator"),n=t.getMeta("description");return o.length>0&&r.length>0?o+=" - "+r:o=t.getTitle(),{popup:!0,shareText:"Flattr",name:"flattr",faName:"fa-money",title:{de:"Artikel flattrn",en:"Flattr this"},shareUrl:"https://flattr.com/submit/auto?title="+encodeURIComponent(o)+"&description="+encodeURIComponent(n)+"&category="+encodeURIComponent(t.options.flattrCategory||"text")+"&user_id="+encodeURIComponent(t.options.flattrUser)+"&url="+e+t.getReferrerTrack()}}; 2161 2162},{}],10:[function(require,module,exports){ 2163"use strict";module.exports=function(o){var e=encodeURIComponent(o.getURL());return{popup:!0,shareText:"+1",name:"googleplus",faName:"fa-google-plus",title:{bg:"Сподели в Google+",da:"Del pÃ¥ Google+",de:"Bei Google+ teilen",en:"Share on Google+",es:"Compartir en Google+",fi:"Jaa Google+:ssa",fr:"Partager sur Goolge+",hr:"Podijelite na Google+",hu:"Megosztás Google+on",it:"Condividi su Google+",ja:"Google+ä¸ã§å ±æ",ko:"Google+ìì ê³µì í기",nl:"Delen op Google+",no:"Del pÃ¥ Google+",pl:"UdostÄpnij na Google+",pt:"Compartilhar no Google+",ro:"PartajeazÄ pe Google+",ru:"ÐоделиÑÑÑÑ Ð½Ð° Google+",sk:"ZdieľaÅ¥ na Google+",sl:"Deli na Google+",sr:"Podeli na Google+",sv:"Dela pÃ¥ Google+",tr:"Google+'da paylaÅ",zh:"å¨Google+ä¸å享"},shareUrl:"https://plus.google.com/share?url="+e+o.getReferrerTrack()}}; 2164 2165},{}],11:[function(require,module,exports){ 2166"use strict";module.exports=function(e){return{blank:!0,popup:!1,shareText:"Info",name:"info",faName:"fa-info",title:{de:"weitere Informationen",en:"more information",es:"más informaciones",fr:"plus d'informations",it:"maggiori informazioni",da:"flere oplysninger",nl:"verdere informatie"},shareUrl:e.getInfoUrl()}}; 2167 2168},{}],12:[function(require,module,exports){ 2169"use strict";module.exports=function(e){var n=encodeURIComponent(e.getURL());return{popup:!0,shareText:{de:"mitteilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"ã·ã§ã¢",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"distribuiÈi",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"linkedin",faName:"fa-linkedin",title:{bg:"Сподели в LinkedIn",da:"Del pÃ¥ LinkedIn",de:"Bei LinkedIn teilen",en:"Share on LinkedIn",es:"Compartir en LinkedIn",fi:"Jaa LinkedInissä",fr:"Partager sur LinkedIn",hr:"Podijelite na LinkedIn",hu:"Megosztás LinkedInen",it:"Condividi su LinkedIn",ja:"LinkedInä¸ã§å ±æ",ko:"LinkedInìì ê³µì í기",nl:"Delen op LinkedIn",no:"Del pÃ¥ LinkedIn",pl:"UdostÄpnij przez LinkedIn",pt:"Compartilhar no LinkedIn",ro:"PartajeazÄ pe LinkedIn",ru:"ÐоделиÑÑÑÑ Ð½Ð° LinkedIn",sk:"ZdieľaÅ¥ na LinkedIn",sl:"Deli na LinkedIn",sr:"Podeli na LinkedIn-u",sv:"Dela pÃ¥ LinkedIn",tr:"LinkedIn'ta payla
2169Å",zh:"å¨LinkedInä¸å享"},shareUrl:"https://www.linkedin.com/cws/share?url="+n+e.getReferrerTrack()}}; 2170 2171},{}],13:[function(require,module,exports){ 2172"use strict";module.exports=function(e){var i=e.getOption("mailUrl");return 0===i.indexOf("mailto:")&&(i+="?subject="+encodeURIComponent(e.getOption("mailSubject")),i+="&body="+encodeURIComponent(e.getOption("mailBody"))),{blank:0===i.indexOf("http"),popup:!1,shareText:"mail",name:"mail",faName:"fa-envelope",title:{bg:"ÐзпÑаÑи по имейл",da:"Sende via e-mail",de:"Per E-Mail versenden",en:"Send by email",es:"Enviar por email",fi:"Lähetä sähköpostitse",fr:"Envoyer par courriel",hr:"PoÅ¡aljite emailom",hu:"Elküldés e-mailben",it:"Inviare via email",ja:"é»åã¡ã¼ã«ã§éä¿¡",ko:"ì´ë©ì¼ë¡ ë³´ë´ê¸°",nl:"Sturen via e-mail",no:"Send via epost",pl:"WyÅlij e-mailem",pt:"Enviar por e-mail",ro:"Trimite prin e-mail",ru:"ÐÑпÑавиÑÑ Ð¿Ð¾ Ñл. поÑÑе",sk:"PoslaÅ¥ e-mailom",sl:"PoÅ¡lji po elektronski poÅ¡ti",sr:"PoÅ¡alji putem email-a",sv:"Skicka via e-post",tr:"E-posta ile gönder",zh:"éè¿çµåé®ä»¶ä¼ é"},shareUrl:i}}; 2173 2174},{}],14:[function(require,module,exports){ 2175"use strict";var url=require("url");module.exports=function(e){var t=e.getMeta("DC.title")||e.getTitle(),r=e.getMeta("DC.creator");r.length>0&&(t+=" - "+r);var i=e.getOption("mediaUrl");i&&i.length<=0&&(i=e.getMeta("og:image"));var n=url.parse("https://www.pinterest.com/pin/create/link/",!0);return n.query.url=e.getURL(),n.query.media=i,n.query.description=t,delete n.search,{popup:!0,shareText:"pin it",name:"pinterest",faName:"fa-pinterest-p",title:{de:"Bei Pinterest pinnen",en:"Pin it on Pinterest",es:"Compartir en Pinterest",fr:"Partager sur Pinterest",it:"Condividi su Pinterest",da:"Del pÃ¥ Pinterest",nl:"Delen op Pinterest"},shareUrl:url.format(n)+e.getReferrerTrack()}}; 2176 2177},{"url":5}],15:[function(require,module,exports){ 2178"use strict";module.exports=function(e){var t=encodeURIComponent(e.getURL()),r=encodeURIComponent(e.getTitle());return""!==r&&(r="&title="+r),{popup:!0,shareText:{de:"teilen",en:"share"},name:"reddit",faName:"fa-reddit",title:{de:"Bei Reddit teilen",en:"Share on Reddit"},shareUrl:"https://reddit.com/submit?url="+t+r+e.getReferrerTrack()}}; 2179 2180},{}],16:[function(require,module,exports){ 2181"use strict";module.exports=function(e){var t=encodeURIComponent(e.getURL()),n=encodeURIComponent(e.getTitle());return""!==n&&(n="&title="+n),{popup:!0,shareText:{de:"teilen",en:"share"},name:"stumbleupon",faName:"fa-stumbleupon",title:{de:"Bei Stumbleupon teilen",en:"Share on Stumbleupon"},shareUrl:"https://www.stumbleupon.com/submit?url="+t+n+e.getReferrerTrack()}}; 2182 2183},{}],17:[function(require,module,exports){ 2184"use strict";module.exports=function(e){var a=encodeURIComponent(e.getURL()),r=e.getMeta("DC.title"),t=e.getMeta("DC.creator");return r.length>0&&t.length>0?r+=" - "+t:r=e.getTitle(),{popup:!1,shareText:{bg:"cподелÑне",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"å ±æ",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"partajeazÄ",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"threema",faName:"fa-lock",title:{bg:"Сподели в Threema",da:"Del pÃ¥ Threema",de:"Bei Threema teilen",en:"Share on Threema",es:"Compartir en Threema",fi:"Jaa Threemaissä",fr:"Partager sur Threema",hr:"Podijelite na Threema",hu:"Megosztás Threemaen",it:"Condividi su Threema",ja:"Threemaä¸ã§å ±æ",ko:"Threemaìì ê³µì í기",nl:"Delen op Threema",no:"Del pÃ¥ Threema",pl:"UdostÄpnij przez Threema",pt:"Compartilhar no Threema",ro:"PartajeazÄ pe Threema",ru:"ÐоделиÑÑÑÑ Ð½Ð° Threema",sk:"ZdieľaÅ¥ na Threema",sl:"Deli na Threema",sr:"Podeli na Threema-u",sv:"Dela pÃ¥ Threema",tr:"Threema'ta paylaÅ",zh:"å¨Threemaä¸å享"},shareUrl:"threema://compose?text="+encodeURIComponent(r)+"%20"+a+e.getReferrerTrack()}}; 2185 2186},{}],18:[function(require,module,exports){ 2187"use strict";module.exports=function(t){var e=encodeURIComponent(t.getURL()),r=t.getMeta("DC.title"),l=t.getMeta("DC.creator");return r.length>0&&l.length>0?r+=" - "+l:r=t.getTitle(),{popup:!0,shareText:{bg:"cподелÑне",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"å ±æ",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"partajeazÄ",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"tumblr",faName:"fa-tumblr",title:{bg:"Сподели в tumblr",da:"Del pÃ¥ tumblr",de:"Bei tumblr teilen",en:"Share on tumblr",es:"Compartir en tumblr",fi:"Jaa tumblrissä",fr:"Partager sur tumblr",hr:"Podijelite na tumblr",hu:"Megosztás tumblren",it:"Condividi su tumblr",ja:"tumblrä¸ã§å ±æ",ko:"tumblrìì ê³µì í기",nl:"Delen op tumblr",no:"Del pÃ¥ tumblr",pl:"UdostÄpnij przez tumblr",pt:"Compartilhar no tumblr",ro:"PartajeazÄ pe tumblr",ru:"ÐоделиÑÑÑÑ Ð½Ð° tumblr",sk:"ZdieľaÅ¥ na tumblr",sl:"Deli na tumblr",sr:"Podeli na tumblr-u",sv:"Dela pÃ¥ tumblr",tr:"tumblr'ta payla
2187Å",zh:"å¨tumblrä¸å享"},shareUrl:"http://tumblr.com/widgets/share/tool?canonicalUrl="+e+t.getReferrerTrack()}}; 2188 2189},{}],19:[function(require,module,exports){ 2190(function (global){ 2191"use strict";var url=require("url"),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),abbreviateText=function(t,e){var r=$("<div/>").html(t).text();if(r.length<=e)return t;var i=r.substring(0,e-1).lastIndexOf(" ");return r=r.substring(0,i)+"â¦"};module.exports=function(t){var e=url.parse("https://twitter.com/intent/tweet",!0),r=t.getMeta("DC.title"),i=t.getMeta("DC.creator");return r.length>0&&i.length>0?r+=" - "+i:r=t.getTitle(),e.query.text=abbreviateText(r,120),e.query.url=t.getURL(),null!==t.options.twitterVia&&(e.query.via=t.options.twitterVia),delete e.search,{popup:!0,shareText:"tweet",name:"twitter",faName:"fa-twitter",title:{bg:"Сподели в Twitter",da:"Del pÃ¥ Twitter",de:"Bei Twitter teilen",en:"Share on Twitter",es:"Compartir en Twitter",fi:"Jaa Twitterissä",fr:"Partager sur Twitter",hr:"Podijelite na Twitteru",hu:"Megosztás Twitteren",it:"Condividi su Twitter",ja:"ãã¤ãã¿ã¼ä¸ã§å ±æ",ko:"í¸ìí°ìì ê³µì í기",nl:"Delen op Twitter",no:"Del pÃ¥ Twitter",pl:"UdostÄpnij na Twitterze",pt:"Compartilhar no Twitter",ro:"PartajeazÄ pe Twitter",ru:"ÐоделиÑÑÑÑ Ð½Ð° Twitter",sk:"ZdieľaÅ¥ na Twitteri",sl:"Deli na Twitterju",sr:"Podeli na Twitter-u",sv:"Dela pÃ¥ Twitter",tr:"Twitter'da paylaÅ",zh:"å¨Twitterä¸å享"},shareUrl:url.format(e)+t.getReferrerTrack()}}; 2192 2193}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 2194},{"url":5}],20:[function(require,module,exports){ 2195"use strict";module.exports=function(a){var p=encodeURIComponent(a.getURL()),e=a.getMeta("DC.title"),t=a.getMeta("DC.creator");return e.length>0&&t.length>0?e+=" - "+t:e=a.getTitle(),{popup:!1,shareText:{bg:"cподелÑне",da:"del",de:"teilen",en:"share",es:"compartir",fi:"Jaa",fr:"partager",hr:"podijelite",hu:"megosztás",it:"condividi",ja:"å ±æ",ko:"ê³µì í기",nl:"delen",no:"del",pl:"udostÄpnij",pt:"compartilhar",ro:"partajeazÄ",ru:"поделиÑÑÑÑ",sk:"zdieľaÅ¥",sl:"deli",sr:"podeli",sv:"dela",tr:"paylaÅ",zh:"å享"},name:"whatsapp",faName:"fa-whatsapp",title:{bg:"Сподели в Whatsapp",da:"Del pÃ¥ Whatsapp",de:"Bei Whatsapp teilen",en:"Share on Whatsapp",es:"Compartir en Whatsapp",fi:"Jaa WhatsAppissä",fr:"Partager sur Whatsapp",hr:"Podijelite na Whatsapp",hu:"Megosztás WhatsAppen",it:"Condividi su Whatsapp",ja:"Whatsappä¸ã§å ±æ",ko:"Whatsappìì ê³µì í기",nl:"Delen op Whatsapp",no:"Del pÃ¥ Whatsapp",pl:"UdostÄpnij przez WhatsApp",pt:"Compartilhar no Whatsapp",ro:"PartajeazÄ pe Whatsapp",ru:"ÐоделиÑÑÑÑ Ð½Ð° Whatsapp",sk:"ZdieľaÅ¥ na Whatsapp",sl:"Deli na Whatsapp",sr:"Podeli na WhatsApp-u",sv:"Dela pÃ¥ Whatsapp",tr:"Whatsapp'ta paylaÅ",zh:"å¨Whatsappä¸å享"},shareUrl:"whatsapp://send?text="+encodeURIComponent(e)+"%20"+p+a.getReferrerTrack()}}; 2196 2197},{}],21:[function(require,module,exports){ 2198"use strict";module.exports=function(e){var r=encodeURIComponent(e.getURL());return{popup:!0,shareText:{de:"teilen",en:"share",es:"compartir",fr:"partager",it:"condividi",da:"del",nl:"delen"},name:"xing",faName:"fa-xing",title:{de:"Bei XING teilen",en:"Share on XING",es:"Compartir en XING",fr:"Partager sur XING",it:"Condividi su XING",da:"Del pÃ¥ XING",nl:"Delen op XING"},shareUrl:"https://www.xing.com/social_plugins/share?url="+r+e.getReferrerTrack()}}; 2199 2200},{}],22:[function(require,module,exports){ 2201(function (global){ 2202"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),url=require("url"),Shariff=function(e,t){var r=this;this.element=e,$(e).empty(),this.options=$.extend({},this.defaults,t,$(e).data());var i=[require("./services/addthis"),require("./services/diaspora"),require("./services/facebook"),require("./services/flattr"),require("./services/googleplus"),require("./services/info"),require("./services/linkedin"),require("./services/mail"),require("./services/pinterest"),require("./services/reddit"),require("./services/stumbleupon"),require("./services/twitter"),require("./services/whatsapp"),require("./services/xing"),require("./services/tumblr"),require("./services/threema")];this.services=$.map(this.options.services,function(e){var t;
2202return i.forEach(function(i){return i=i(r),i.name===e?(t=i,null):void 0}),t}),this._addButtonList(),null!==this.options.backendUrl&&this.getShares().then($.proxy(this._updateCounts,this))};Shariff.prototype={defaults:{theme:"color",backendUrl:null,infoUrl:"http://ct.de/-2467514",lang:"de",langFallback:"en",mailUrl:function(){var e=url.parse(this.getURL(),!0);return e.query.view="mail",delete e.search,url.format(e)},mailSubject:function(){return this.getMeta("DC.title")||this.getTitle()},mailBody:function(){return"<"+this.getURL()+">"},mediaUrl:null,orientation:"horizontal",referrerTrack:null,services:["twitter","facebook","googleplus","info"],title:function(){return $("head title").text()},twitterVia:null,flattrUser:null,flattrCategory:null,url:function(){var e=global.document.location.href,t=$("link[rel=canonical]").attr("href")||this.getMeta("og:url")||"";return t.length>0&&(t.indexOf("http")<0&&(t=global.document.location.protocol+"//"+global.document.location.host+t),e=t),e}},$socialshareElement:function(){return $(this.element)},getLocalized:function(e,t){return"object"==typeof e[t]?"undefined"==typeof e[t][this.options.lang]?e[t][this.options.langFallback]:e[t][this.options.lang]:"string"==typeof e[t]?e[t]:void 0},getMeta:function(e){var t=$('meta[name="'+e+'"],[property="'+e+'"]').attr("content");return t||""},getInfoUrl:function(){return this.options.infoUrl},getURL:function(){return this.getOption("url")},getOption:function(e){var t=this.options[e];return"function"==typeof t?$.proxy(t,this)():t},getTitle:function(){return this.getOption("title")},getReferrerTrack:function(){return this.options.referrerTrack||""},getShares:function(){var e=url.parse(this.options.backendUrl,!0);return e.query.url=this.getURL(),delete e.search,$.getJSON(url.format(e))},_updateCounts:function(e){var t=this;$.each(e,function(e,r){r>=1e3&&(r=Math.round(r/1e3)+"k"),$(t.element).find("."+e+" a").append('<span class="share_count">'+r)})},_addButtonList:function(){var e=this,t=this.$socialshareElement(),r="theme-"+this.options.theme,i="orientation-"+this.options.orientation,n="col-"+this.options.services.length,a=$("<ul>").addClass(r).addClass(i).addClass(n);this.services.forEach(function(t){var r=$('<li class="shariff-button">').addClass(t.name),i='<span class="share_text">'+e.getLocalized(t,"shareText"),n=$("<a>").attr("href",t.shareUrl).append(i);"undefined"!=typeof t.faName&&n.prepend('<span class="fa '+t.faName+'">'),t.popup?n.attr("data-rel","popup"):t.blank&&n.attr("target","_blank"),n.attr("title",e.getLocalized(t,"title")),n.attr("role","button"),n.attr("aria-label",e.getLocalized(t,"title")),r.append(n),a.append(r)}),a.on("click",'[data-rel="popup"]',function(e){e.preventDefault();var t=$(this).attr("href"),r="_blank",i="600",n="460",a="width="+i+",height="+n;global.window.open(t,r,a)}),t.append(a)}},module.exports=Shariff,global.Shariff=Shariff,$(".shariff").each(function(){this.hasOwnProperty("shariff")||(this.shariff=new Shariff(this))}); 2203}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 2204},{"./services/addthis":6,"./services/diaspora":7,"./services/facebook":8,"./services/flattr":9,"./services/googleplus":10,"./services/info":11,"./services/linkedin":12,"./services/mail":13,"./services/pinterest":14,"./services/reddit":15,"./services/stumbleupon":16,"./services/threema":17,"./services/tumblr":18,"./services/twitter":19,"./services/whatsapp":20,"./services/xing":21,"url":5}]},{},[22]); 2205 2206/** 2207 * toggle FAQ Items 2208 **/ 2209//jQuery.noConflict(); 2210jQuery(document).ready(function($){ 2211 2212 var plus = 'tx-irfaq-toggle-plus'; 2213 var minus = 'tx-irfaq-toggle-minus' 2214 var title = '.tx-irfaq-toggle .tx-irfaq-dynheader'; 2215 var content = '.tx-irfaq-toggle .tx-irfaq-dynans'; 2216 var effectDuration = 250; 2217 2218 jQuery(title).click(function() { 2219 if(jQuery(this).next().css('display')=='block') { 2220 jQuery(this).addClass(plus).removeClass(minus); 2221 }else { 2222 jQuery(this).addClass(minus).removeClass(plus); 2223 } 2224 jQuery(this).next().slideToggle(effectDuration); 2225 2226 return false; 2227 }).next().hide(); 2228 2229 jQuery('.tx-irfaq-toggle-all-show').click(function() { 2230 jQuery(title).addClass(minus).removeClass(plus); 2231 jQuery(content).show(effectDuration); 2232 return false;
2233 }); 2234 jQuery('.tx-irfaq-toggle-all-hide').click(function() { 2235 jQuery(title).addClass(plus).removeClass(minus); 2236 jQuery(content).hide(effectDuration); 2237 return false; 2238 }); 2239}); 2240 2241/*! 2242 * JavaScript Cookie v2.0.4 2243 * https://github.com/js-cookie/js-cookie 2244 * 2245 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 2246 * Released under the MIT license 2247 */ 2248(function (factory) { 2249 if (typeof define === 'function' && define.amd) { 2250 define(factory); 2251 } else if (typeof exports === 'object') { 2252 module.exports = factory(); 2253 } else { 2254 var _OldCookies = window.Cookies; 2255 var api = window.Cookies = factory(); 2256 api.noConflict = function () { 2257 window.Cookies = _OldCookies; 2258 return api; 2259 }; 2260 } 2261}(function () { 2262 function extend () { 2263 var i = 0; 2264 var result = {}; 2265 for (; i < arguments.length; i++) { 2266 var attributes = arguments[ i ]; 2267 for (var key in attributes) { 2268 result[key] = attributes[key]; 2269 } 2270 } 2271 return result; 2272 } 2273 2274 function init (converter) { 2275 function api (key, value, attributes) { 2276 var result; 2277 2278 // Write 2279 2280 if (arguments.length > 1) { 2281 attributes = extend({ 2282 path: '/' 2283 }, api.defaults, attributes); 2284 2285 if (typeof attributes.expires === 'number') { 2286 var expires = new Date(); 2287 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 2288 attributes.expires = expires; 2289 } 2290 2291 try { 2292 result = JSON.stringify(value); 2293 if (/^[\{\[]/.test(result)) { 2294 value = result; 2295 } 2296 } catch (e) {} 2297 2298 if (!converter.write) { 2299 value = encodeURIComponent(String(value)) 2300 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 2301 } else { 2302 value = converter.write(value, key); 2303 } 2304 2305 key = encodeURIComponent(String(key)); 2306 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 2307 key = key.replace(/[\(\)]/g, escape); 2308 2309 return (document.cookie = [ 2310 key, '=', value, 2311 attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE 2312 attributes.path && '; path=' + attributes.path, 2313 attributes.domain && '; domain=' + attributes.domain, 2314 attributes.secure ? '; secure' : '' 2315 ].join('')); 2316 } 2317 2318 // Read 2319 2320 if (!key) { 2321 result = {}; 2322 } 2323 2324 // To prevent the for loop in the first place assign an empty array 2325 // in case there are no cookies at all. Also prevents odd result when 2326 // calling "get()" 2327 var cookies = document.cookie ? document.cookie.split('; ') : []; 2328 var rdecode = /(%[0-9A-Z]{2})+/g; 2329 var i = 0; 2330 2331 for (; i < cookies.length; i++) { 2332 var parts = cookies[i].split('='); 2333 var name = parts[0].replace(rdecode, decodeURIComponent); 2334 var cookie = parts.slice(1).join('='); 2335 2336 if (cookie.charAt(0) === '"') { 2337 cookie = cookie.slice(1, -1); 2338 } 2339 2340 try { 2341 cookie = converter.read ? 2342 converter.read(cookie, name) : converter(cookie, name) || 2343 cookie.replace(rdecode, decodeURIComponent); 2344 2345 if (this.json) { 2346 try { 2347 cookie = JSON.parse(cookie); 2348 } catch (e) {} 2349 } 2350 2351 if (key === name) { 2352 result = cookie; 2353 break; 2354 } 2355 2356 if (!key) { 2357 result[name] = cookie; 2358 } 2359 } catch (e) {} 2360 } 2361 2362 return result; 2363 } 2364 2365 api.get = api.set = api; 2366 api.getJSON = function () { 2367 return api.apply({ 2368 json: true 2369 }, [].slice.call(arguments)); 2370 }; 2371 api.defaults = {}; 2372 2373 api.remove = function (key, attributes) { 2374 api(key, '', extend(attributes, { 2375 expires: -1 2376 })); 2377 }; 2378 2379 api.withConverter = init; 2380 2381 return api; 2382 } 2383 2384 return init(function () {}); 2385})); 2386 2387jQuery(document).ready(function ($) { 2388 startNTCSocial(); 2389}); 2390$(document).ajaxComplete(function(){ 2391 startNTCSocial(); 2392}); 2393function startNTCSocial(){ 2394 if(!$('.ntc_socialblock_pi1').length){ 2395 return false; 2396 } 2397 // variables to pass from options 2398 2399 // Facebook: 2400 var fb_page_url = options["tx_ntcsocialblock_pi1"]["fburl"]; 2401 2402 // Twitter 2403 var tw_user = options["tx_ntcsocialblock_pi1"]["twuser"]; 2404 var tw_widget_id = options["tx_ntcsocialblock_pi1"]["twappid"]; 2405 2406 2407 // Facebook like box 2408 var fbBox = function() { 2409 $('.ntcsocial #fb-root').remove(); 2410 $('.ntcsocial .fb-page').remove(); 2411 $('#fb-activate').remove(); 2412 $('#fb-deactivate').remove(); 2413 $('.ntcsocial').append( 2414 '<div id="fb-root"></div>', 2415 '<div class="fb-page" data-href="' + fb_page_url + '" data-tabs="timeline" data-width="225" data-height="600" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="' + fb_page_url + '"><a href="' + fb_page_url + '">Facebook</a></blockquote></div></div>', 2416 '<button id="fb-deactivate" class="btn btn-success">Facebook deaktivieren</div>' 2417 ); 2418 $('#fb-deactivate').on("click",function() {killFB();}); 2419 2420 (function(d, s, id) { 2421 var js, fjs = d.getElementsByTagName(s)[0]; 2422 if (d.getElementById(id)) return; 2423 js = d.createElement(s); js.id = id; 2424 js.src = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&version=v2.5&appId=249924078420704"; 2425 fjs.parentNode.insertBefore(js, fjs); 2426 }(document, 'script', 'facebook-jssdk')); 2427 Cookies.set('socialSharePrivacy_facebook', 'perma_on', { expires : 365 }); 2428 }; 2429 2430 var killFB = function() { 2431 $('.ntcsocial .fb-page').remove(); 2432 $('.ntcsocial #fb-root').remove(); 2433 $('#fb-deactivate').remove(); 2434 $('#fb-activate').remove(); 2435 $('.ntcsocial').append('<button id="fb-activate" class="btn btn-success">Mit Facebook verbinden</div>'); 2436 $('#fb-activate').on("click",function() {fbBox();}); 2437 Cookies.remove('socialSharePrivacy_facebook'); 2438 location.reload(); 2439 }; 2440 2441 // Twitter timeline 2442 var twBox = function() { 2443 $('.ntcsocial .twitter-timeline').remove();
2444 if($('#twitter-widget-0').length==0){ 2445 $('#tw-deactivate').remove(); 2446 $('#tw-activate').remove(); 2447 2448 $('.ntcsocial').append( 2449 '<a class="twitter-timeline" data-lang="de" data-height="500" data-theme="light" href="https://twitter.com/' + tw_user + '?ref_src=twsrc%5Etfw">Tweets by ' + tw_user + '</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'); 2450 $('.ntcsocial').append('<button id="tw-deactivate" class="btn btn-success">Twitter deaktivieren</div>'); 2451 (function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs")); 2452 Cookies.set('socialSharePrivacy_twitter', 'perma_on', { expires : 365 }); 2453 $('#tw-deactivate').on("click",function() {killTW();}); 2454 } 2455 }; 2456 2457 var killTW = function() { 2458 $('.ntcsocial .twitter-timeline').remove(); 2459 $('#tw-deactivate').remove(); 2460 $('#tw-activate').remove(); 2461 $('.ntcsocial').append('<button id="tw-activate" class="btn btn-success">Mit Twitter verbinden</div>'); 2462 Cookies.remove('socialSharePrivacy_twitter'); 2463 location.reload(); 2464 }; 2465 2466 if(options["tx_ntcsocialblock_pi1"]["what_to_display"].indexOf("FBLB")>=0){ 2467 // Check if Facebook is activated 2468 if (Cookies.get('socialSharePrivacy_facebook') == 'perma_on') { 2469 fbBox(); 2470 } else { 2471 $('#fb-activate').remove(); 2472 $('.ntcsocial').append('<button id="fb-activate" class="btn btn-success">Mit Facebook verbinden</div>'); 2473 }; 2474 }; 2475 2476 $('#fb-activate').on("click",function() {fbBox();}); 2477 2478 $('#fb-deactivate').on("click",function() {killFB();}); 2479 2480 if(options["tx_ntcsocialblock_pi1"]["what_to_display"].indexOf("TWF")>=0){ 2481 //Check if Twitter is activated 2482 if (Cookies.get('socialSharePrivacy_twitter') == 'perma_on') { 2483 twBox(); 2484 } else { 2485 $('#tw-activate').remove(); 2486 $('.ntcsocial').append( 2487 '<button id="tw-activate" class="btn btn-success">Mit Twitter verbinden</div>' 2488 ); 2489 }; 2490 }; 2491 $('#tw-activate').on('click', function() {twBox();}); 2492 2493 $('#tw-deactivate').on('click', function() { killTW();}); 2494 2495 2496}; 2497 2498!function(){if(!window.hasCookieConsent){window.hasCookieConsent=!0;var e="cookieconsent_options",t="update_cookieconsent_options",n="cookieconsent_dismissed",i="/typo3conf/ext/ntc_gcms2014/Resources/Public/Css/";if(!(document.cookie.indexOf(n)>-1)){"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o,s={isArray:function(e){var t=Object.prototype.toString.call(e);return"[object Array]"==t},isObject:function(e){return"[object Object]"==Object.prototype.toString.call(e)},each:function(e,t,n,i){if(s.isObject(e)&&!i)for(var o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o,e);else for(var r=0,c=e.length;c>r;r++)t.call(n,e[r],r,e)},merge:function(e,t){e&&s.each(t,function(t,n){s.isObject(t)&&s.isObject(e[n])?s.merge(e[n],t):e[n]=t})},bind:function(e,t){return function(){return e.apply(t,arguments)}},queryObject:function(e,t){var n,i=0,o=e;for(t=t.split(".");(n=t[i++])&&o.hasOwnProperty(n)&&(o=o[n]);)if(i===t.length)return o;return null},setCookie:function(e,t,n,i,o){n=n||365;var s=new Date;s.setDate(s.getDate()+n);var r=[e+"="+t,"expires="+s.toUTCString(),"path="+o||"/"];i&&r.push("domain="+i),document.cookie=r.join(";")},addEventListener:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}},r=function(){var e="data-cc-event",t="data-cc-if",n=function(e,t,i){return s.isArray(t)?s.each(t,function(t){n(e,t,i)}):void(e.addEventListener?e.addEventListener(t,i):e.attachEvent("on"+t,i))},i=function(e,t){return e.replace(/\{\{(.*?)\}\}/g,function(e,n){for(var i,o,r=n.split("||");o=r.shift();){if(o=o.trim(),'"'===o[0])return o.slice(1,o.length-1);if(i=s.queryObject(t,o))return i}return""})},o=function(e){var t=document.createElement("div");return t.innerHTML=e,t.children[0]},r=function(e,t,n){var i=e.parentNode.querySelectorAll("["+t+"]");s.each(i,function(e){var i=e.getAttribute(t);n(e,i)},window,!0)},c=function(t,i){r(t,e,function(e,t){var o=t.split(":"),r=s.queryObject(i,o[1]);n(e,o[0],s.bind(r,i))})},a=function(e,n){r(e,t,function(e,t){var i=s.queryObject(n,t);i||e.parentNode.removeChild(e)})};return{build:function(e,t){s.isArray(e)&&(e=e.join("")),e=i(e,t);var n=o(e);return c(n,t),a(n,t),n}}}(),c={options:{message:"Diese Website nutzt Cookies zur Bereitstellung ihrer Dienste. Durch die Nutzung erklären Sie sich damit einverstanden, dass wir Cookies setzen. ",dismiss:"Einverstanden!",learnMore:"More info",link:null,target:"_self",container:null,theme:"light-floating",domain:null,path:"/",expiryDays:365,markup:['<div class="cc_banner-wrapper {{containerClasses}}">','<div class="cc_banner cc_container cc_container--open">','<a href="#null" data-cc-event="click:dismiss" target="_blank" class="cc_btn cc_btn_accept_all">{{options.dismiss}}</a>','<p class="cc_message">{{options.message}} <a data-cc-if="options.link" target="{{ options.target }}" class="cc_more_info" href="{{options.link || "#null"}}">{{options.learnMore}}</a></p>','<a class="cc_logo"></a><!-- cookiescript basierend auf https://silktide.com/tools/cookie-consent/ danke -->',"</div>","</div>"]},init:function(){var t=window[e];t&&this.setOptions(t),this.setContainer(),this.options.theme?this.loadTheme(this.render):this.render()},setOptionsOnTheFly:function(e){this.setOptions(e),this.render()},setOptions:function(e){s.merge(this.options,e)},setContainer:function(){this.options.container?this.container=document.querySelector(this.options.container):this.container=document.body,this.containerClasses="",navigator.appVersion.indexOf("MSIE 8")>-1&&(this.containerClasses+=" cc_ie8")},loadTheme:function(e){var t=this.options.theme;-1===t.indexOf(".css")&&(t=i+t+".css");var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t;var o=!1;n.onload=s.bind(function(){!o&&e&&(e.call(this),o=!0)},this),document.getElementsByTagName("head")[0].appendChild(n)},render:function(){this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),delete this.element),this.element=r.build(this.options.markup,this),this.container.firstChild?this.container.insertBefore(this.element,this.container.firstChild):this.container.appendChild(this.element)},dismiss:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1,this.setDismissedCookie(),this.container.removeChild(this.element)}
2498,setDismissedCookie:function(){s.setCookie(n,"yes",this.options.expiryDays,this.options.domain,this.options.path)}},a=!1;(o=function(){a||"complete"!=document.readyState||(c.init(),a=!0,window[t]=s.bind(c.setOptionsOnTheFly,c))})(),s.addEventListener(document,"readystatechange",o)}}}(); 2499 2500/* Modernizr 2.0.6 (Custom Build) | MIT & BSD 2501 * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderradius-boxshadow-rgba-textshadow-cssanimations-cssgradients-csstransitions-touch-iepp-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load 2502 */ 2503;window.Modernizr=function(a,b,c){function C(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return B(d,b)}function B(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function A(a,b){return!!~(""+a).indexOf(b)}function z(a,b){return typeof a===b}function y(a,b){return x(n.join(a+";")+(b||""))}function x(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["­","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u,v={}.hasOwnProperty,w;!z(v,c)&&!z(v.call,c)?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],c)};var D=function(c,d){var f=c.join(""),g=d.length;t(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",n.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join("")],["fontface","touch"]);p.touch=function(){return e.touch},p.rgba=function(){x("background-color:rgba(150,255,150,.5)");return A(k.backgroundColor,"rgba")},p.backgroundsize=function(){return C("backgroundSize")},p.borderradius=function(){return C("borderRadius")},p.boxshadow=function(){return C("boxShadow")},p.textshadow=function(){return b.createElement("div").style.textShadow===""},p.cssanimations=function(){return C("animationName")},p.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";x((a+n.join(b+a)+n.join(c+a)).slice(0,-a.length));return A(k.backgroundImage,"gradient")},p.csstransitions=function(){return C("transitionProperty")},p.fontface=function(){return e.fontface};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));x(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";
2503var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=n,e._domPrefixes=o,e.testProp=function(a){return B([a])},e.testAllProps=C,e.testStyles=t,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))}; 2504/*! 2505 jQuery rondell plugin 2506 @name jquery.rondell.js 2507 @author Sebastian Helzle ([email protected] or @sebobo) 2508 @version 1.1.0 2509 @date 10/27/2013 2510 @category jQuery plugin
2511 @copyright (c) 2009-2013 Sebastian Helzle (www.sebastianhelzle.net) 2512 @license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. 2513*/ 2514 2515var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; 2516 2517(function($, win, doc) { 2518 var $document, $window, Rondell, RondellItem, RondellScrollbar, classCaption, classContainer, classControl, classInitializing, classInstance, classItem, classItemCrop, classItemError, classItemFocused, classItemHidden, classItemHovered, classItemImage, classItemLoading, classItemOverlay, classItemResizeable, classItemSmall, classLightbox, classLightboxClose, classLightboxContent, classLightboxInner, classLightboxNext, classLightboxOverlay, classLightboxPosition, classLightboxPrev, classNoScale, classScrollbar, classScrollbarBackground, classScrollbarControl, classScrollbarDragging, classScrollbarInner, classScrollbarLeft, classScrollbarRight, classShiftLeft, classShiftRight, classThemePrefix, closeLightbox, delayCall, eventClick, eventMousewheel, eventResize, getActiveRondell, getLightbox, lightboxIsVisible, resizeLightbox, resizeTimer, rondellBaseClass, updateLightbox, _base; 2519 $window = $(win); 2520 $document = $(doc); 2521 rondellBaseClass = 'rondell'; 2522 classInstance = "" + rondellBaseClass + "-instance"; 2523 classContainer = "" + rondellBaseClass + "-container"; 2524 classInitializing = "" + rondellBaseClass + "-initializing"; 2525 classThemePrefix = "" + rondellBaseClass + "-theme"; 2526 classCaption = "" + rondellBaseClass + "-caption"; 2527 classControl = "" + rondellBaseClass + "-control"; 2528 classShiftLeft = "" + rondellBaseClass + "-shift-left"; 2529 classShiftRight = "" + rondellBaseClass + "-shift-right"; 2530 classNoScale = "" + rondellBaseClass + "-no-scale"; 2531 classItem = "" + rondellBaseClass + "-item"; 2532 classItemImage = "" + classItem + "-image"; 2533 classItemResizeable = "" + classItem + "-resizeable"; 2534 classItemSmall = "" + classItem + "-small"; 2535 classItemHidden = "" + classItem + "-hidden"; 2536 classItemLoading = "" + classItem + "-loading"; 2537 classItemHovered = "" + classItem + "-hovered"; 2538 classItemOverlay = "" + classItem + "-overlay"; 2539 classItemFocused = "" + classItem + "-focused"; 2540 classItemCrop = "" + classItem + "-crop"; 2541 classItemError = "" + classItem + "-error"; 2542 classLightbox = "" + rondellBaseClass + "-lightbox"; 2543 classLightboxOverlay = "" + classLightbox + "-overlay"; 2544 classLightboxContent = "" + classLightbox + "-content"; 2545 classLightboxInner = "" + classLightbox + "-inner"; 2546 classLightboxClose = "" + classLightbox + "-close"; 2547 classLightboxPrev = "" + classLightbox + "-prev"; 2548 classLightboxPosition = "" + classLightbox + "-position"; 2549 classLightboxNext = "" + classLightbox + "-next"; 2550 classScrollbar = "" + rondellBaseClass + "-scrollbar"; 2551 classScrollbarControl = "" + classScrollbar + "-control"; 2552 classScrollbarDragging = "" + classScrollbar + "-dragging"; 2553 classScrollbarBackground = "" + classScrollbar + "-background"; 2554 classScrollbarLeft = "" + classScrollbar + "-left"; 2555 classScrollbarRight = "" + classScrollbar + "-right"; 2556 classScrollbarInner = "" + classScrollbar + "-inner"; 2557 eventClick = "click." + rondellBaseClass; 2558 eventResize = "resize." + rondellBaseClass; 2559 eventMousewheel = "mousewheel." + rondellBaseClass; 2560 /* Global rondell plugin properties*/ 2561 2562 $.rondell || ($.rondell = { 2563 version: '1.1.0', 2564 name: 'rondell', 2565 lightbox: { 2566 instance: void 0, 2567 template: $.trim(" <div class='" + classLightbox + "'> <div class='" + classLightboxOverlay + "'> </div> <div class='" + classLightboxContent + "'> <div class='" + classLightboxInner + "'/> <div class='" + classLightboxClose + "'>Χ</div> <div class='" + classLightboxPrev + "'>«</div> <div class='" + classLightboxPosition + "'>1</div> <div class='" + classLightboxNext + "'>»</div> </div> </div>") 2568 }, 2569 defaults: { 2570 showContainer: true, 2571 currentLayer: 0, 2572 radius: { 2573 x: 250, 2574 y: 50 2575 }, 2576 center: { 2577 left: 340, 2578 top: 160 2579 }, 2580 size: { 2581 width: null, 2582 height: null 2583 }, 2584 visibleItems: 'auto', 2585 scaling: 2, 2586 opacityMin: 0.05, 2587 fadeTime: 300, 2588 keyDelay: 300, 2589 zIndex: 1000, 2590 itemProperties: { 2591 delay: 100, 2592 size: { 2593 width: 150, 2594 height: 150 2595 }, 2596 sizeFocused: { 2597 width: 0, 2598 height: 0 2599 } 2600 }, 2601 lightbox: { 2602 enabled: true, 2603 displayReferencedImages: true 2604 }, 2605 imageFiletypes: ['png', 'jpg', 'jpeg', 'gif', 'bmp'], 2606 repeating: true, 2607 wrapIndices: true, 2608 switchIndices: false, 2609 alwaysShowCaption: false, 2610 captionsEnabled: true, 2611 autoRotation: { 2612 enabled: false, 2613 paused: false, 2614 direction: 0, 2615 once: false, 2616 delay: 5000 2617 }, 2618 controls: { 2619 enabled: true, 2620 fadeTime: 400, 2621 margin: { 2622 x: 130, 2623 y: 270 2624 } 2625 },
2626 strings: { 2627 prev: 'Zurück', 2628 next: 'Weiter', 2629 loadingError: 'An error occured while loading <b>%s</b>', 2630 more: 'More...' 2631 }, 2632 mousewheel: { 2633 enabled: true, 2634 threshold: 0, 2635 minTimeBetweenShifts: 500 2636 }, 2637 touch: { 2638 enabled: true, 2639 preventDefaults: true, 2640 threshold: 100 2641 }, 2642 randomStart: false, 2643 funcEase: 'easeInOutQuad', 2644 theme: 'default', 2645 preset: '', 2646 effect: null, 2647 onAfterShift: null, 2648 onUpdateLightbox: null, 2649 cropThumbnails: false, 2650 scrollbar: { 2651 enabled: false, 2652 orientation: "bottom", 2653 start: 1, 2654 end: 100, 2655 stepSize: 1, 2656 keepStepOrder: true, 2657 position: 1, 2658 padding: 10, 2659 style: { 2660 width: "100%", 2661 height: 20, 2662 left: "auto", 2663 right: "auto", 2664 top: "auto", 2665 bottom: "auto" 2666 }, 2667 repeating: false, 2668 onScroll: void 0, 2669 scrollOnHover: false, 2670 scrollOnDrag: true 2671 } 2672 } 2673 }); 2674 /* Add default easing function for rondell to jQuery if missing*/ 2675 2676 (_base = $.easing).easeInOutQuad || (_base.easeInOutQuad = function(x, t, b, c, d) { 2677 if ((t /= d / 2) < 1) { 2678 return c / 2 * t * t + b; 2679 } else { 2680 return -c / 2 * ((--t) * (t - 2) - 1) + b; 2681 } 2682 }); 2683 delayCall = function(delay, callback) { 2684 return setTimeout(callback, delay); 2685 }; 2686 Rondell = (function() { 2687 Rondell.rondellCount = 0; 2688 2689 Rondell.activeRondell = null; 2690 2691 function Rondell(container, options, initCallback) { 2692 var children, item, presetOptions, scrollbarContainer, _i, _len; 2693 this.container = container; 2694 this.initCallback = initCallback != null ? initCallback : void 0; 2695 this.showLightbox = __bind(this.showLightbox, this); 2696 this.keyDown = __bind(this.keyDown, this); 2697 this.isFocused = __bind(this.isFocused, this); 2698 this.onWindowBlur = __bind(this.onWindowBlur, this); 2699 this.onWindowFocus = __bind(this.onWindowFocus, this); 2700 this._autoShift = __bind(this._autoShift, this); 2701 this._autoShiftInit = __bind(this._autoShiftInit, this); 2702 this.shiftRight = __bind(this.shiftRight, this); 2703 this.shiftLeft = __bind(this.shiftLeft, this); 2704 this._refreshControls = __bind(this._refreshControls, this); 2705 this.getIndexInRange = __bind(this.getIndexInRange, this); 2706 this.getRelativeItemPosition = __bind(this.getRelativeItemPosition, this); 2707 this.shiftTo = __bind(this.shiftTo, this); 2708 this._hover = __bind(this._hover, this); 2709 this._onTouch = __bind(this._onTouch, this); 2710 this._onMousewheel = __bind(this._onMousewheel, this); 2711 this.bindEvents = __bind(this.bindEvents, this); 2712 this._start = __bind(this._start, this); 2713 this.onItemInit = __bind(this.onItemInit, this); 2714 this._loadItem = __bind(this._loadItem, this); 2715 this._getItem = __bind(this._getItem, this); 2716 this._onMouseLeaveItem = __bind(this._onMouseLeaveItem, this); 2717 this._onMouseEnterItem = __bind(this._onMouseEnterItem, this); 2718 this.fitToContainer = __bind(this.fitToContainer, this); 2719 this.clear = __bind(this.clear, this); 2720 this.update = __bind(this.update, this); 2721 this.id = ++Rondell.rondellCount; 2722 this.items = []; 2723 children = container.children(); 2724 this.maxItems = children.length; 2725 if (this.id === 1) { 2726 Rondell.activeRondell = this.id; 2727 } 2728 presetOptions = (options != null ? options.preset : void 0) in $.rondell.presets ? $.rondell.presets[options.preset] : {}; 2729 $.extend(true, this, $.rondell.defaults, presetOptions, options || {}); 2730 $.extend(true, this, { 2731 _dimensions: { 2732 computed: false 2733 }, 2734 _lastKeyEvent: 0, 2735 _windowFocused: true, 2736 _focusedIndex: this.currentLayer, 2737 _itemIndices: { 2738 0: 0 2739 }, 2740 autoRotation: { 2741 _timer: -1 2742 }, 2743 controls: { 2744 _lastShift: 0 2745 }, 2746 touch: { 2747 _start: void 0, 2748 _end: void 0 2749 }, 2750 scrollbar: { 2751 _instance: null 2752 } 2753 }); 2754 this.itemProperties.sizeFocused = { 2755 width: this.itemProperties.sizeFocused.width || this.itemProperties.size.width * this.scaling, 2756 height: this.itemProperties.sizeFocused.height || this.itemProperties.size.height * this.scaling 2757 }; 2758 this.size = { 2759 width: this.size.width || this.center.left * 2, 2760 height: this.size.height || this.center.top * 2 2761 }; 2762 this.container.data(rondellBaseClass, this).css(this.size).addClass("" + classInitializing + " " + classContainer + " " + classThemePrefix + "-" + this.theme + " " + classInstance + "-" + this.id); 2763 if (this.scrollbar.enabled) {
2764 scrollbarContainer = $('<div/>'); 2765 this.container.append(scrollbarContainer); 2766 $.extend(true, this.scrollbar, { 2767 onScroll: this.shiftTo, 2768 end: this.maxItems, 2769 position: this.currentLayer, 2770 repeating: this.repeating 2771 }); 2772 this.scrollbar._instance = new RondellScrollbar(scrollbarContainer, this.scrollbar); 2773 } 2774 for (_i = 0, _len = children.length; _i < _len; _i++) { 2775 item = children[_i]; 2776 this._loadItem($(item)); 2777 } 2778 if (this.showContainer) { 2779 this.container.show(); 2780 } 2781 } 2782 2783 Rondell.prototype.update = function(options) { 2784 $.extend(true, this, options || {}); 2785 return this.shiftTo(this.currentLayer); 2786 }; 2787 2788 Rondell.prototype.clear = function() { 2789 this.container.data(rondellBaseClass, this).removeClass("" + this.lassInitializing + " " + classContainer + " " + classThemePrefix + "-" + this.theme + " " + classInstance + "-" + this.id).find("." + classControl).remove(); 2790 this.container.children("." + classItem).removeClass(classItem); 2791 return this.container.rondell = null; 2792 }; 2793 2794 Rondell.prototype.equals = function(objA, objB) { 2795 var key, value; 2796 for (key in objA) { 2797 value = objA[key]; 2798 if (objB[key] !== value) { 2799 return false; 2800 } 2801 } 2802 for (key in objB) { 2803 value = objB[key]; 2804 if (objA[key] !== value) { 2805 return false; 2806 } 2807 } 2808 return true; 2809 }; 2810 2811 Rondell.prototype.funcLeft = function(l, r, i) { 2812 return r.center.left - r.itemProperties.size.width / 2.0 + Math.sin(l) * r.radius.x; 2813 }; 2814 2815 Rondell.prototype.funcTop = function(l, r, i) { 2816 return r.center.top - r.itemProperties.size.height / 2.0 + Math.cos(l) * r.radius.y; 2817 }; 2818 2819 Rondell.prototype.funcDiff = function(d, r, i) { 2820 return Math.pow(Math.abs(d) / r.maxItems, 0.5) * Math.PI; 2821 }; 2822 2823 Rondell.prototype.funcOpacity = function(l, r, i) { 2824 if (r.visibleItems > 1) { 2825 return Math.max(0, 1.0 - Math.pow(l / r.visibleItems, 2)); 2826 } else if (r.visibleItems === 1) { 2827 return 1; 2828 } else { 2829 return 0; 2830 } 2831 }; 2832 2833 Rondell.prototype.funcSize = function(l, r, i) { 2834 return 1; 2835 }; 2836 2837 Rondell.prototype.fitToContainer = function() { 2838 var newHeight, newWidth, oldHeight, oldWidth, parentContainer; 2839 parentContainer = this.container.parent(); 2840 newWidth = parentContainer.innerWidth(); 2841 newHeight = parentContainer.innerHeight(); 2842 if (!this._dimensions.computed) { 2843 oldWidth = this.size.width; 2844 oldHeight = this.size.height; 2845 $.extend(true, this._dimensions, { 2846 computed: true, 2847 center: { 2848 left: this.center.left / oldWidth, 2849 top: this.center.top / oldHeight 2850 }, 2851 radius: { 2852 x: this.radius.x / oldWidth, 2853 y: this.radius.y / oldHeight 2854 }, 2855 controls: { 2856 margin: { 2857 x: this.controls.margin.x / oldWidth, 2858 y: this.controls.margin.y / oldHeight 2859 } 2860 }, 2861 itemProperties: { 2862 size: { 2863 width: this.itemProperties.size.width / oldWidth, 2864 height: this.itemProperties.size.height / oldHeight 2865 }, 2866 sizeFocused: { 2867 width: this.itemProperties.sizeFocused.width / oldWidth, 2868 height: this.itemProperties.sizeFocused.height / oldHeight 2869 } 2870 } 2871 }); 2872 } 2873 $.extend(true, this, { 2874 size: { 2875 width: newWidth, 2876 height: newHeight 2877 }, 2878 center: { 2879 left: this._dimensions.center.left * newWidth, 2880 top: this._dimensions.center.top * newHeight 2881 }, 2882 radius: { 2883 x: this._dimensions.radius.x * newWidth, 2884 y: this._dimensions.radius.y * newHeight 2885 }, 2886 controls: { 2887 margin: { 2888 x: this._dimensions.controls.margin.x * newWidth, 2889 y: this._dimensions.controls.margin.y * newHeight 2890 } 2891 }, 2892 itemProperties: { 2893 size: { 2894 width: this._dimensions.itemProperties.size.width * newWidth, 2895 height: this._dimensions.itemProperties.size.height * newHeight 2896 }, 2897 sizeFocused: { 2898 width: this._dimensions.itemProperties.sizeFocused.width * newWidth, 2899 height: this._dimensions.itemProperties.sizeFocused.height * newHeight 2900 } 2901 } 2902 }); 2903 this.container.css(this.size); 2904 return this.shiftTo(this.currentLayer); 2905 }; 2906 2907 Rondell.prototype._onMouseEnterItem = function(idx) { 2908 return this._getItem(idx).onMouseEnter(); 2909 }; 2910 2911 Rondell.prototype._onMouseLeaveItem = function(idx) { 2912 return this._getItem(idx).onMouseLeave(); 2913 }; 2914 2915 Rondell.prototype._getItem = function(idx) { 2916 return this.items[idx - 1]; 2917 }; 2918 2919 Rondell.prototype._loadItem = function(obj) { 2920 var idx; 2921 idx = this.items.length + 1; 2922 this._itemIndices[idx] = idx; 2923 this.items.push(new RondellItem(idx, obj, this).init()); 2924 if (idx === this.maxItems) { 2925 return this._start(); 2926 } 2927 }; 2928 2929 Rondell.prototype.onItemInit = function(idx) { 2930 var item; 2931 item = this._getItem(idx); 2932 if (idx === this.currentLayer) { 2933 item.prepareFadeIn(); 2934 } else { 2935 item.prepareFadeOut(); 2936 } 2937 return item.runAnimation(true); 2938 }; 2939 2940 Rondell.prototype._start = function() { 2941 var controls; 2942 if (this.randomStart) { 2943 this.currentLayer = Math.round(Math.random() * (this.maxItems - 1)); 2944 } else { 2945 this.currentLayer = Math.max(0, Math.min(this.currentLayer || Math.round(this.maxItems / 2), this.maxItems)); 2946 } 2947 if (this.visibleItems === "auto") { 2948 this.visibleItems = Math.max(2, ~~(this.maxItems / 2)); 2949 } 2950 controls = this.controls;
2951 if (controls.enabled) { 2952 this.controls._shiftLeft = $("<a href=\"#/\"/>").addClass("" + classControl + " " + classShiftLeft).html(this.strings.prev).click(this.shiftLeft).css({ 2953 left: controls.margin.x, 2954 top: controls.margin.y, 2955 zIndex: this.zIndex + this.maxItems + 2 2956 }); 2957 this.controls._shiftRight = $("<a href=\"#/\"/>").addClass("" + classControl + " " + classShiftRight).html(this.strings.next).click(this.shiftRight).css({ 2958 right: controls.margin.x, 2959 top: controls.margin.y, 2960 zIndex: this.zIndex + this.maxItems + 2 2961 }); 2962 this.container.append(this.controls._shiftLeft, this.controls._shiftRight); 2963 } 2964 this.bindEvents(); 2965 this.container.removeClass(classInitializing); 2966 if (typeof this.initCallback === "function") { 2967 this.initCallback(this); 2968 } 2969 if (this._focusedItem == null) { 2970 this._focusedItem = this._getItem(this.currentLayer); 2971 } 2972 return this.shiftTo(this.currentLayer); 2973 }; 2974 2975 Rondell.prototype.bindEvents = function() { 2976 var rondell; 2977 $document.keydown(this.keyDown); 2978 $window.blur(this.onWindowBlur).focus(this.onWindowFocus); 2979 $document.focusout(this.onWindowBlur).focusin(this.onWindowFocus); 2980 if (this.mousewheel.enabled && ($.fn.mousewheel != null)) { 2981 this.container.bind("mousewheel." + rondellBaseClass, this._onMousewheel); 2982 } 2983 if (this._onMobile()) { 2984 if (this.touch.enabled) { 2985 this.container.bind("touchstart." + rondellBaseClass + " touchmove." + rondellBaseClass + " touchend." + rondellBaseClass, this._onTouch); 2986 } 2987 } else { 2988 this.container.bind("mouseenter." + rondellBaseClass + " mouseleave." + rondellBaseClass, this._hover); 2989 } 2990 rondell = this; 2991 return this.container.delegate("." + classItem, "click." + rondellBaseClass, function(e) { 2992 var item; 2993 item = $(this).data("item"); 2994 // FBO check href 2995 var linkUrl = rondell._focusedItem.object.attr('href'); 2996 2997 if (rondell._focusedItem.id === item.id) { 2998 if (rondell.lightbox.enabled && (!linkUrl || linkUrl.length < 5)) { 2999 e.preventDefault(); 3000 return rondell.showLightbox(); 3001 } 3002 } else { 3003 e.preventDefault(); 3004 if (!item.hidden && item.object.is(":visible")) { 3005 return rondell.shiftTo(item.currentSlot); 3006 } 3007 } 3008 }).delegate("." + classItem, "mouseenter." + rondellBaseClass + " mouseleave." + rondellBaseClass, function(e) { 3009 var item; 3010 item = $(this).data("item"); 3011 if (e.type === "mouseenter") { 3012 return rondell._onMouseEnterItem(item.id); 3013 } else { 3014 return rondell._onMouseLeaveItem(item.id); 3015 } 3016 }); 3017 }; 3018 3019 Rondell.prototype._onMobile = function() { 3020 /* 3021 Mobile device detection. 3022 Check for touch functionality is currently enough. 3023 */ 3024 3025 return typeof Modernizr !== "undefined" && Modernizr !== null ? Modernizr.touch : void 0; 3026 }; 3027 3028 Rondell.prototype._onMousewheel = function(e, d, dx, dy) { 3029 /* 3030 Allows rondell traveling with mousewheel. 3031 Requires mousewheel plugin for jQuery. 3032 */ 3033 3034 var now, selfYCenter, viewportBottom, viewportTop; 3035 if (!(this.mousewheel.enabled && this.isFocused())) { 3036 return; 3037 } 3038 now = (new Date()).getTime(); 3039 if (now - this.mousewheel._lastShift < this.mousewheel.minTimeBetweenShifts) { 3040 return; 3041 } 3042 viewportTop = $window.scrollTop(); 3043 viewportBottom = viewportTop + $window.height(); 3044 selfYCenter = this.container.offset().top + this.container.outerHeight() / 2; 3045 if (selfYCenter > viewportTop && selfYCenter < viewportBottom && Math.abs(dx) > this.mousewheel.threshold) { 3046 e.preventDefault(); 3047 if (dx < 0) { 3048 this.shiftLeft(); 3049 } else { 3050 this.shiftRight(); 3051 } 3052 return this.mousewheel._lastShift = now; 3053 } 3054 }; 3055 3056 Rondell.prototype._onTouch = function(e) { 3057 var changeX, touch; 3058 if (!this.touch.enabled) { 3059 return; 3060 } 3061 touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 3062 switch (e.type) { 3063 case "touchstart": 3064 this.touch._start = { 3065 x: touch.pageX, 3066 y: touch.pageY 3067 }; 3068 break; 3069 case "touchmove": 3070 if (this.touch.preventDefaults) { 3071 e.preventDefault(); 3072 } 3073 this.touch._end = { 3074 x: touch.pageX, 3075 y: touch.pageY 3076 }; 3077 break; 3078 case "touchend": 3079 if (this.touch._start && this.touch._end) { 3080 changeX = this.touch._end.x - this.touch._start.x; 3081 if (Math.abs(changeX) > this.touch.threshold) { 3082 if (changeX > 0) { 3083 this.shiftLeft(); 3084 } else if (changeX < 0) { 3085 this.shiftRight(); 3086 } 3087 } 3088 this.touch._start = this.touch._end = void 0; 3089 } 3090 } 3091 return true; 3092 }; 3093 3094 Rondell.prototype._hover = function(e) { 3095 /* 3096 Shows/hides rondell controls. 3097 Starts/pauses autorotation. 3098 Updates active rondell id. 3099 */ 3100 3101 var paused; 3102 paused = this.autoRotation.paused; 3103 if (e.type === "mouseenter") { 3104 Rondell.activeRondell = this.id; 3105 this.hovering = true; 3106 if (!paused) { 3107 this.autoRotation.paused = true; 3108 this._focusedItem.showCaption(); 3109 } 3110 } else { 3111 this.hovering = false;
3112 if (paused && !this.autoRotation.once) { 3113 this.autoRotation.paused = false; 3114 this._autoShiftInit(); 3115 } 3116 if (!this.alwaysShowCaption) { 3117 this._focusedItem.hideCaption(); 3118 } 3119 } 3120 if (this.controls.enabled) { 3121 return this._refreshControls(); 3122 } 3123 }; 3124 3125 Rondell.prototype.shiftTo = function(idx, keepOrder) { 3126 var distance, item, newItem, newItemIndex, relativeIndex, scrollbarIdx, _i, _j, _len, _len1, _ref, _ref1, _ref2; 3127 if (keepOrder == null) { 3128 keepOrder = false; 3129 } 3130 if (idx == null) { 3131 return; 3132 } 3133 if (!keepOrder && this.switchIndices && idx !== this.currentLayer && this.getIndexInRange(idx) === this._focusedItem.currentSlot) { 3134 _ref = this.getRelativeItemPosition(idx, true), distance = _ref[0], relativeIndex = _ref[1]; 3135 if (relativeIndex > this.currentLayer) { 3136 idx++; 3137 } else { 3138 idx--; 3139 } 3140 } 3141 idx = this.getIndexInRange(idx); 3142 newItemIndex = this._itemIndices[idx]; 3143 newItem = this._getItem(newItemIndex); 3144 if (this.switchIndices) { 3145 this._itemIndices[idx] = this._focusedItem.id; 3146 this._itemIndices[this._focusedItem.currentSlot] = newItemIndex; 3147 newItem.currentSlot = this._focusedItem.currentSlot; 3148 this._focusedItem.currentSlot = idx; 3149 } 3150 this._focusedItem = newItem; 3151 this.currentLayer = idx; 3152 this._focusedItem.prepareFadeIn(); 3153 _ref1 = this.items; 3154 for (_i = 0, _len = _ref1.length; _i < _len; _i++) { 3155 item = _ref1[_i]; 3156 if (item !== this._focusedItem) { 3157 item.prepareFadeOut(); 3158 } 3159 } 3160 _ref2 = this.items; 3161 for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { 3162 item = _ref2[_j]; 3163 item.runAnimation(); 3164 } 3165 this._autoShiftInit(); 3166 this._refreshControls(); 3167 if (this.lightbox.enabled && lightboxIsVisible()) { 3168 this.showLightbox(); 3169 } 3170 if (this.scrollbar.enabled) { 3171 scrollbarIdx = idx; 3172 if (idx === this._focusedItem.currentSlot) { 3173 scrollbarIdx = this._focusedItem.currentSlot + 1; 3174 } 3175 this.scrollbar._instance.setPosition(scrollbarIdx, false); 3176 } 3177 return typeof this.onAfterShift === "function" ? this.onAfterShift(idx) : void 0; 3178 }; 3179 3180 Rondell.prototype.getRelativeItemPosition = function(idx, wrapIndices) { 3181 var distance, relativeIndex; 3182 if (wrapIndices == null) { 3183 wrapIndices = this.wrapIndices; 3184 } 3185 distance = Math.abs(idx - this.currentLayer); 3186 relativeIndex = idx; 3187 if (distance > this.visibleItems && distance > this.maxItems / 2 && this.repeating && wrapIndices) { 3188 if (idx > this.currentLayer) { 3189 relativeIndex -= this.maxItems; 3190 } else { 3191 relativeIndex += this.maxItems; 3192 } 3193 distance = Math.abs(relativeIndex - this.currentLayer); 3194 } 3195 return [distance, relativeIndex]; 3196 }; 3197 3198 Rondell.prototype.getIndexInRange = function(idx) { 3199 if (this.repeating) { 3200 if (idx < 1) { 3201 idx += this.maxItems; 3202 } else if (idx > this.maxItems) { 3203 idx -= this.maxItems; 3204 } 3205 } else { 3206 if (idx < 1) { 3207 idx = 1; 3208 } else if (idx > this.maxItems) { 3209 idx = this.maxItems; 3210 } 3211 } 3212 return idx; 3213 }; 3214 3215 Rondell.prototype._refreshControls = function() { 3216 if (!this.controls.enabled) { 3217 return; 3218 } 3219 this.controls._shiftLeft.stop().fadeTo(this.controls.fadeTime, (this.currentLayer > 1 || this.repeating) && this.hovering ? 1 : 0); 3220 return this.controls._shiftRight.stop().fadeTo(this.controls.fadeTime, (this.currentLayer < this.maxItems || this.repeating) && this.hovering ? 1 : 0); 3221 }; 3222 3223 Rondell.prototype.shiftLeft = function(e) { 3224 if (e != null) { 3225 e.preventDefault(); 3226 } 3227 return this.shiftTo(this.currentLayer - 1); 3228 }; 3229 3230 Rondell.prototype.shiftRight = function(e) { 3231 if (e != null) { 3232 e.preventDefault(); 3233 } 3234 return this.shiftTo(this.currentLayer + 1); 3235 }; 3236 3237 Rondell.prototype._autoShiftInit = function() { 3238 var autoRotation; 3239 autoRotation = this.autoRotation; 3240 if (this.isActive() && autoRotation.enabled && autoRotation._timer < 0) { 3241 return autoRotation._timer = window.setTimeout(this._autoShift, autoRotation.delay); 3242 } 3243 }; 3244 3245 Rondell.prototype._autoShift = function() { 3246 this.autoRotation._timer = -1; 3247 if (this.isActive() && this.isFocused() && !lightboxIsVisible() && !this.autoRotation.paused) { 3248 if (this.autoRotation.direction) { 3249 return this.shiftRight(); 3250 } else { 3251 return this.shiftLeft(); 3252 } 3253 } else { 3254 return this._autoShiftInit(); 3255 } 3256 }; 3257 3258 Rondell.prototype.onWindowFocus = function() { 3259 return this._windowFocused = true; 3260 }; 3261 3262 Rondell.prototype.onWindowBlur = function() { 3263 return this._windowFocused = false;
3264 }; 3265 3266 Rondell.prototype.isActive = function() { 3267 return true; 3268 }; 3269 3270 Rondell.prototype.isFocused = function() { 3271 return this._windowFocused && Rondell.activeRondell === this.id; 3272 }; 3273 3274 Rondell.prototype.keyDown = function(e) { 3275 var keyCode, now; 3276 if (!(this.isActive() && this.isFocused())) { 3277 return; 3278 } 3279 now = (new Date()).getTime(); 3280 if (this._lastKeyEvent > now - this.keyDelay) { 3281 return; 3282 } 3283 if (this.autoRotation._timer >= 0) { 3284 window.clearTimeout(this.autoRotation._timer); 3285 this.autoRotation._timer = -1; 3286 } 3287 this._lastKeyEvent = now; 3288 keyCode = e.which || e.keyCode; 3289 switch (keyCode) { 3290 case 37: 3291 return this.shiftLeft(e); 3292 case 39: 3293 return this.shiftRight(e); 3294 case 27: 3295 return closeLightbox(); 3296 } 3297 }; 3298 3299 Rondell.prototype.showLightbox = function() { 3300 var lightbox, lightboxContent, 3301 _this = this; 3302 lightbox = getLightbox(); 3303 lightboxContent = $("." + classLightboxContent, lightbox); 3304 if (!lightboxIsVisible()) { 3305 lightbox.add(lightboxContent).css('visibility', 'hidden'); 3306 } 3307 return lightboxContent.stop().fadeTo(100, 0, function() { 3308 var attr, content, icon, iconCopy, linkTarget, linkUrl, _i, _len, _ref; 3309 content = $("." + classLightboxInner, lightboxContent).html(_this._focusedItem.object.html()); 3310 $("." + classLightboxPosition).text("" + _this.currentLayer + " | " + _this.maxItems); 3311 $("." + classItemOverlay, content).style = ''; 3312 if (_this._focusedItem.isLink) { 3313 linkUrl = _this._focusedItem.object.attr('href'); 3314 linkTarget = _this._focusedItem.object.attr('target'); 3315// $("." + classCaption, content).append("<a href='" + linkUrl + "' target='" + linkTarget + "'>" + _this.strings.more + "</a>").attr('style', ''); 3316 $("." + classCaption, content).wrap("<a href='" + linkUrl + "' target='" + linkTarget + "'></a>").attr('style', ''); 3317 } 3318 icon = $("." + classItemImage, content); 3319 if (icon && _this._focusedItem.referencedImage) { 3320 _ref = ['style', 'width', 'height']; 3321 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 3322 attr = _ref[_i]; 3323 icon.removeAttr(attr); 3324 } 3325 icon[0].src = _this._focusedItem.referencedImage; 3326 } 3327 if (icon && !icon[0].complete) { 3328 iconCopy = $("<img style=\"display:none\"/>"); 3329 lightboxContent.append(_this.iconCopy); 3330 return iconCopy.one('load', updateLightbox)[0].src = _this._focusedItem.referencedImage; 3331 } else { 3332 return setTimeout(updateLightbox, 0); 3333 } 3334 }); 3335 }; 3336 3337 return Rondell; 3338 3339 })(); 3340 getActiveRondell = function() { 3341 return $("." + classInstance + "-" + Rondell.activeRondell).data('rondell'); 3342 }; 3343 resizeTimer = 0; 3344 resizeLightbox = function() { 3345 clearTimeout(resizeTimer); 3346 if (lightboxIsVisible()) { 3347 return resizeTimer = setTimeout(updateLightbox, 200); 3348 } 3349 }; 3350 lightboxIsVisible = function() { 3351 var _ref; 3352 return (_ref = $.rondell.lightbox.instance) != null ? _ref.is(':visible') : void 0; 3353 }; 3354 closeLightbox = function() { 3355 if (lightboxIsVisible()) { 3356 return getLightbox().stop().fadeOut(150); 3357 } 3358 }; 3359 getLightbox = function() { 3360 var lightbox; 3361 if (!$.rondell.lightbox.instance) { 3362 lightbox = $.rondell.lightbox.instance = $($.rondell.lightbox.template).appendTo($('body')); 3363 $("." + classLightboxOverlay + ", ." + classLightboxClose, lightbox).bind(eventClick, closeLightbox); 3364 $("." + classLightboxPrev, lightbox).bind(eventClick, function() { 3365 return getActiveRondell().shiftLeft(); 3366 }); 3367 $("." + classLightboxNext, lightbox).bind(eventClick, function() { 3368 return getActiveRondell().shiftRight(); 3369 }); 3370 $window.bind(eventResize, resizeLightbox); 3371 lightbox.bind(eventMousewheel, function(e, d, dx, dy) { 3372 return getActiveRondell()._onMousewheel(e, d, dx, dy); 3373 }); 3374 } 3375 return $.rondell.lightbox.instance; 3376 }; 3377 updateLightbox = function() { 3378 var $lightbox, $lightboxContent, activeRondell, focusedItem, image, imageDimension, imageHeight, imageWidth, maxHeight, maxWidth, newHeight, newProps, newWidth, updateCallback, winHeight, winWidth, windowPadding; 3379 $lightbox = getLightbox(); 3380 $lightboxContent = $("." + classLightboxContent, $lightbox); 3381 winWidth = $window.innerWidth(); 3382 winHeight = $window.innerHeight(); 3383 windowPadding = 20; 3384 activeRondell = getActiveRondell(); 3385 focusedItem = activeRondell._focusedItem; 3386 $lightbox.css('display', 'block'); 3387 image = $('img:first', $lightboxContent); 3388 if (image.length) { 3389 if (!focusedItem.lightboxImageWidth) { 3390 focusedItem.lightboxImageWidth = image[0].width; 3391 focusedItem.lightboxImageHeight = image[0].height; 3392 image.attr('width', focusedItem.lightboxImageWidth).attr('height', focusedItem.lightboxImageHeight); 3393 } 3394 imageWidth = focusedItem.lightboxImageWidth; 3395 imageHeight = focusedItem.lightboxImageHeight; 3396 imageDimension = imageWidth / imageHeight; 3397 maxWidth = winWidth - windowPadding * 2; 3398 maxHeight = winHeight - windowPadding * 2; 3399 if (imageWidth > maxWidth) { 3400 imageWidth = maxWidth; 3401 imageHeight = imageWidth / imageDimension; 3402 } 3403 if (imageHeight > maxHeight) { 3404 imageHeight = maxHeight; 3405 imageWidth = imageHeight * imageDimension; 3406 } 3407 image.css({ 3408 width: imageWidth, 3409 height: imageHeight 3410 }); 3411 } 3412 $lightbox.add($lightboxContent).css('visibility', 'visible'); 3413 newWidth = $lightboxContent.outerWidth(); 3414 newHeight = $lightboxContent.outerHeight(); 3415 newProps = { 3416 marginLeft: -newWidth / 2, 3417 top: Math.max((winHeight - newHeight) / 2, 20) 3418 }; 3419 updateCallback = function() { 3420 return typeof activeRondell.onUpdateLightbox === "function" ? activeRondell.onUpdateLightbox(focusedItem) : void 0; 3421 }; 3422 if ($lightboxContent.css('opacity') < 1) { 3423 $lightboxContent.css(newProps).fadeTo(200, 1, updateCallback); 3424 } else {
3425 newProps.opacity = 1; 3426 $lightboxContent.animate(newProps, 200, updateCallback); 3427 } 3428 return $lightbox.stop().fadeTo(150, 1); 3429 }; 3430 RondellItem = (function() { 3431 function RondellItem(id, object, rondell) { 3432 this.id = id; 3433 this.object = object; 3434 this.rondell = rondell; 3435 this.runAnimation = __bind(this.runAnimation, this); 3436 this.onAnimationFinished = __bind(this.onAnimationFinished, this); 3437 this.prepareFadeOut = __bind(this.prepareFadeOut, this); 3438 this.prepareFadeIn = __bind(this.prepareFadeIn, this); 3439 this.hideCaption = __bind(this.hideCaption, this); 3440 this.showCaption = __bind(this.showCaption, this); 3441 this.onMouseLeave = __bind(this.onMouseLeave, this); 3442 this.onMouseEnter = __bind(this.onMouseEnter, this); 3443 this.finalize = __bind(this.finalize, this); 3444 this.onError = __bind(this.onError, this); 3445 this.onIconLoad = __bind(this.onIconLoad, this); 3446 this.refreshDimensions = __bind(this.refreshDimensions, this); 3447 this.init = __bind(this.init, this); 3448 this.currentSlot = this.id; 3449 this.focused = this.hidden = this.animating = false; 3450 this.isNew = this.resizeable = true; 3451 this.icon = this.iconCopy = this.referencedImage = null; 3452 this.croppedSize = this.rondell.itemProperties.size; 3453 this.sizeSmall = this.rondell.itemProperties.size; 3454 this.sizeFocused = this.rondell.itemProperties.sizeFocused; 3455 this.objectCSSTarget = {}; 3456 this.objectAnimationTarget = {}; 3457 this.lastObjectAnimationTarget = {}; 3458 this.iconAnimationTarget = {}; 3459 this.lastIconAnimationTarget = {}; 3460 this.animationSpeed = this.rondell.fadeTime; 3461 this.isLink = this.object.is('a'); 3462 } 3463 3464 RondellItem.prototype.init = function() { 3465 var filetype, icon, linkType, linkUrl, _i, _len, _ref; 3466 if (this.object.is('img')) { 3467 this.object = this.object.wrap("<div/>").parent(); 3468 } 3469 this.object.addClass(classItem).data('item', this).css({ 3470 opacity: 0, 3471 width: this.sizeSmall.width, 3472 height: this.sizeSmall.height, 3473 left: this.rondell.center.left - this.sizeFocused.width / 2, 3474 top: this.rondell.center.top - this.sizeFocused.height / 2 3475 }); 3476 if (this.isLink && this.rondell.lightbox.displayReferencedImages) { 3477 linkUrl = this.object.attr('href'); 3478 linkType = this._getFiletype(linkUrl); 3479 _ref = this.rondell.imageFiletypes; 3480 for (_i = 0, _len = _ref.length; _i < _len; _i++) { 3481 filetype = _ref[_i]; 3482 if (!(linkType === filetype)) { 3483 continue; 3484 } 3485 this.referencedImage = linkUrl; 3486 break; 3487 } 3488 } 3489 icon = this.object.find('img:first'); 3490 if (icon.length) { 3491 this.icon = icon; 3492 this.resizeable = !icon.hasClass(classNoScale); 3493 this.icon.addClass(classItemImage); 3494 this.object.addClass(classItemLoading); 3495 if (icon.width() > 0 || (icon[0].complete && icon[0].width > 0)) { 3496 window.setTimeout(this.onIconLoad, 10); 3497 } else { 3498 this.iconCopy = $("<img style=\"display:none\"/>"); 3499 $('body').append(this.iconCopy); 3500 this.iconCopy.one('load', this.onIconLoad).one('error', this.onError).attr('src', icon.attr('src')); 3501 } 3502 } else { 3503 delayCall(0, this.finalize); 3504 } 3505 return this; 3506 }; 3507 3508 RondellItem.prototype._getFiletype = function(filename) { 3509 return filename.substr(filename.lastIndexOf('.') + 1).toLowerCase(); 3510 }; 3511 3512 RondellItem.prototype.refreshDimensions = function() { 3513 var croppedSize, foHeight, foWidth, focusedSize, iconHeight, iconWidth, itemSize, smHeight, smWidth, _ref, _ref1, _ref2, _ref3, _ref4; 3514 iconWidth = ((_ref = this.iconCopy) != null ? _ref.width() : void 0) || ((_ref1 = this.iconCopy) != null ? _ref1[0].width : void 0) || this.icon[0].width || this.icon.width(); 3515 iconHeight = ((_ref2 = this.iconCopy) != null ? _ref2.height() : void 0) || ((_ref3 = this.iconCopy) != null ? _ref3[0].height : void 0) || this.icon[0].height || this.icon.height(); 3516 foWidth = smWidth = iconWidth; 3517 foHeight = smHeight = iconHeight; 3518 itemSize = this.rondell.itemProperties.size; 3519 focusedSize = this.rondell.itemProperties.sizeFocused; 3520 croppedSize = itemSize; 3521 if ((_ref4 = this.iconCopy) != null) { 3522 _ref4.remove(); 3523 } 3524 if (!(iconWidth && iconHeight)) { 3525 return; 3526 } 3527 if (this.resizeable) { 3528 this.icon.addClass(classItemResizeable); 3529 smHeight *= itemSize.width / smWidth; 3530 smWidth = itemSize.width; 3531 if (smHeight > itemSize.height) { 3532 smWidth *= itemSize.height / smHeight; 3533 smHeight = itemSize.height; 3534 } 3535 if (this.rondell.cropThumbnails) { 3536 if (!this.icon.parent().hasClass(classItemResizeable)) { 3537 this.icon.wrap($("<div>").addClass(classItemCrop)); 3538 } 3539 croppedSize = { 3540 width: itemSize.width, 3541 height: itemSize.width / smWidth * smHeight 3542 }; 3543 if (croppedSize.height < itemSize.height) { 3544 croppedSize = { 3545 width: itemSize.height / croppedSize.height * croppedSize.
3545width, 3546 height: itemSize.height 3547 }; 3548 } 3549 smWidth = itemSize.width; 3550 smHeight = itemSize.height; 3551 } 3552 foHeight *= focusedSize.width / foWidth; 3553 foWidth = focusedSize.width; 3554 if (foHeight > focusedSize.height) { 3555 foWidth *= focusedSize.height / foHeight; 3556 foHeight = focusedSize.height; 3557 } 3558 } else { 3559 smWidth = itemSize.width; 3560 smHeight = itemSize.height; 3561 foWidth = focusedSize.width; 3562 foHeight = focusedSize.height; 3563 } 3564 this.croppedSize = croppedSize; 3565 this.iconWidth = iconWidth; 3566 this.iconHeight = iconHeight; 3567 this.sizeSmall = { 3568 width: Math.round(smWidth), 3569 height: Math.round(smHeight) 3570 }; 3571 return this.sizeFocused = { 3572 width: Math.round(foWidth), 3573 height: Math.round(foHeight) 3574 }; 3575 }; 3576 3577 RondellItem.prototype.onIconLoad = function() { 3578 this.refreshDimensions(); 3579 return this.finalize(); 3580 }; 3581 3582 RondellItem.prototype.onError = function() { 3583 var errorString, _ref; 3584 errorString = this.rondell.strings.loadingError.replace("%s", this.icon.attr("src")); 3585 this.icon.remove(); 3586 if ((_ref = this.iconCopy) != null) { 3587 _ref.remove(); 3588 } 3589 return this.object.removeClass(classItemLoading).addClass(classItemError).html("<p>" + errorString + "</p>"); 3590 }; 3591 3592 RondellItem.prototype.finalize = function() { 3593 var caption, captionContent, captionWrap, _ref, _ref1, _ref2, _ref3; 3594 this.object.removeClass(classItemLoading); 3595 if (this.rondell.captionsEnabled) { 3596 captionContent = null; 3597 if (this.rondell.cropThumbnails) { 3598 captionContent = (_ref = this.icon) != null ? _ref.closest("." + this.classItemCrop).siblings() : void 0; 3599 } else { 3600 captionContent = (_ref1 = this.icon) != null ? _ref1.siblings() : void 0; 3601 } 3602 if (!((captionContent != null ? captionContent.length : void 0) || this.icon) && this.object.children().length) { 3603 captionContent = this.object.children(); 3604 } 3605 if (!(captionContent != null ? captionContent.length : void 0)) { 3606 caption = this.object.attr("title") || ((_ref2 = this.icon) != null ? _ref2.attr("title") : void 0) || ((_ref3 = this.icon) != null ? _ref3.attr("alt") : void 0); 3607 if (caption) { 3608 captionContent = $("<p>" + caption + "</p>"); 3609 this.object.append(captionContent); 3610 } 3611 } 3612 if (captionContent != null ? captionContent.length : void 0) { 3613 captionWrap = (captionContent.wrapAll("<div/>")).parent().addClass(classCaption); 3614 if (this.icon) { 3615 this.overlay = captionWrap.addClass(classItemOverlay); 3616 } 3617 } 3618 } 3619 return this.rondell.onItemInit(this.id); 3620 }; 3621 3622 RondellItem.prototype.onMouseEnter = function() { 3623 if (!this.animating && !this.hidden && this.object.is(":visible")) { 3624 return this.object.addClass(this.rondell.itemHoveredClass).stop(true).animate({ 3625 opacity: 1 3626 }, this.rondell.fadeTime, this.rondell.funcEase); 3627 } 3628 }; 3629 3630 RondellItem.prototype.onMouseLeave = function() { 3631 this.object.removeClass(classItemHovered); 3632 if (!(this.animating || this.hidden)) { 3633 return this.object.stop(true).animate({ 3634 opacity: this.objectAnimationTarget.opacity 3635 }, this.rondell.fadeTime, this.rondell.funcEase); 3636 } 3637 }; 3638 3639 RondellItem.prototype.showCaption = function() { 3640 if (this.rondell.captionsEnabled && (this.overlay != null)) { 3641 return this.overlay.stop(true).css({ 3642 height: "auto", 3643 overflow: "auto" 3644 }).fadeTo(300, 1); 3645 } 3646 }; 3647 3648 RondellItem.prototype.hideCaption = function() { 3649 var _ref; 3650 if (this.rondell.captionsEnabled && ((_ref = this.overlay) != null ? _ref.is(":visible") : void 0)) { 3651 return this.overlay.stop(true).css({ 3652 height: this.overlay.height(), 3653 overflow: "hidden" 3654 }).fadeTo(200, 0); 3655 } 3656 }; 3657 3658 RondellItem.prototype.prepareFadeIn = function() { 3659 var iconMarginLeft, iconMarginTop, itemFocusedHeight, itemFocusedWidth; 3660 this.focused = true; 3661 this.hidden = false;
3662 itemFocusedWidth = this.sizeFocused.width; 3663 itemFocusedHeight = this.sizeFocused.height; 3664 this.lastObjectAnimationTarget = this.objectAnimationTarget; 3665 this.objectAnimationTarget = { 3666 width: itemFocusedWidth, 3667 height: itemFocusedHeight, 3668 left: this.rondell.center.left - itemFocusedWidth / 2, 3669 top: this.rondell.center.top - itemFocusedHeight / 2, 3670 opacity: 1 3671 }; 3672 this.objectCSSTarget = { 3673 zIndex: this.rondell.zIndex + this.rondell.maxItems, 3674 display: "block" 3675 }; 3676 this.animationSpeed = this.rondell.fadeTime; 3677 if (this.icon) { 3678 this.lastIconAnimationTarget = this.iconAnimationTarget; 3679 iconMarginLeft = 0; 3680 iconMarginTop = 0; 3681 if (!this.resizeable) { 3682 iconMarginTop = (this.rondell.itemProperties.sizeFocused.height - this.iconHeight) / 2; 3683 iconMarginLeft = (this.rondell.itemProperties.sizeFocused.width - this.iconWidth) / 2; 3684 this.iconAnimationTarget.marginTop = iconMarginTop; 3685 this.iconAnimationTarget.marginLeft = iconMarginLeft; 3686 } 3687 if (this.rondell.cropThumbnails) { 3688 return this.iconAnimationTarget = { 3689 marginTop: iconMarginTop, 3690 marginLeft: iconMarginLeft, 3691 width: itemFocusedWidth, 3692 height: itemFocusedHeight 3693 }; 3694 } 3695 } 3696 }; 3697 3698 RondellItem.prototype.prepareFadeOut = function() { 3699 var idx, itemHeight, itemSize, itemWidth, layerDiff, layerDist, layerPos, newTarget, newZ, relativeSize, rondellItemProperties, _ref; 3700 this.focused = false; 3701 idx = this.currentSlot; 3702 rondellItemProperties = this.rondell.itemProperties; 3703 itemSize = rondellItemProperties.size; 3704 _ref = this.rondell.getRelativeItemPosition(idx), layerDist = _ref[0], layerPos = _ref[1]; 3705 layerDiff = this.rondell.funcDiff(layerPos - this.rondell.currentLayer, this.rondell, idx); 3706 if (layerPos < this.rondell.currentLayer) { 3707 layerDiff *= -1; 3708 } 3709 relativeSize = this.rondell.funcSize(layerDiff, this.rondell); 3710 itemWidth = this.sizeSmall.width * relativeSize; 3711 itemHeight = this.sizeSmall.height * relativeSize; 3712 newZ = this.rondell.zIndex - layerDist; 3713 this.animationSpeed = this.rondell.fadeTime + rondellItemProperties.delay * layerDist; 3714 newTarget = { 3715 width: itemWidth, 3716 height: itemHeight, 3717 left: this.rondell.funcLeft(layerDiff, this.rondell, idx) + (itemSize.width - itemWidth) / 2, 3718 top: this.rondell.funcTop(layerDiff, this.rondell, idx) + (itemSize.height - itemHeight) / 2, 3719 opacity: 0 3720 }; 3721 this.objectCSSTarget = { 3722 zIndex: newZ, 3723 display: "block" 3724 }; 3725 if (layerDist <= this.rondell.visibleItems) { 3726 newTarget.opacity = this.rondell.funcOpacity(layerDiff, this.rondell, idx); 3727 this.hidden = false; 3728 if (this.icon) { 3729 this.lastIconAnimationTarget = this.iconAnimationTarget; 3730 if (this.rondell.cropThumbnails) { 3731 this.iconAnimationTarget = { 3732 marginTop: (itemSize.height - this.croppedSize.height) / 2, 3733 marginLeft: (itemSize.width - this.croppedSize.width) / 2, 3734 width: this.croppedSize.width, 3735 height: this.croppedSize.height 3736 }; 3737 } 3738 if (!this.resizeable) { 3739 this.iconAnimationTarget = { 3740 marginTop: (itemSize.height - this.iconHeight) / 2, 3741 marginLeft: (itemSize.width - this.iconWidth) / 2 3742 }; 3743 } 3744 } 3745 } else if (this.hidden) { 3746 $.extend(this.objectCSSTarget, newTarget); 3747 } 3748 this.lastObjectAnimationTarget = this.objectAnimationTarget; 3749 return this.objectAnimationTarget = newTarget; 3750 }; 3751 3752 RondellItem.prototype.onAnimationFinished = function() { 3753 this.animating = false; 3754 if (this.focused) { 3755 this.object.addClass(classItemFocused); 3756 if (this.rondell.hovering || this.rondell.alwaysShowCaption || this.rondell._onMobile()) { 3757 return this.showCaption(); 3758 } 3759 } else { 3760 if (this.objectAnimationTarget.opacity < this.rondell.opacityMin) { 3761 this.hidden = true; 3762 return this.object.css("display", "none"); 3763 } else { 3764 this.hidden = false;
3765 return this.object.css("display", "block"); 3766 } 3767 } 3768 }; 3769 3770 RondellItem.prototype.runAnimation = function(force) { 3771 if (force == null) { 3772 force = false; 3773 } 3774 this.object.css(this.objectCSSTarget); 3775 if (!this.hidden) { 3776 if ((force || this.iconAnimationTarget) && this.icon && (this.focused || !this.rondell.equals(this.iconAnimationTarget, this.lastIconAnimationTarget))) { 3777 this.icon.stop(true).animate(this.iconAnimationTarget, this.animationSpeed, this.rondell.funcEase); 3778 } 3779 if ((force || (this.objectAnimationTarget != null)) && (this.focused || !this.rondell.equals(this.objectAnimationTarget, this.lastObjectAnimationTarget))) { 3780 this.animating = true; 3781 this.object.stop(true).animate(this.objectAnimationTarget, this.animationSpeed, this.rondell.funcEase, this.onAnimationFinished); 3782 if (!this.focused) { 3783 this.object.removeClass(classItemFocused); 3784 return this.hideCaption(); 3785 } 3786 } else { 3787 return this.onAnimationFinished(); 3788 } 3789 } 3790 }; 3791 3792 return RondellItem; 3793 3794 })(); 3795 RondellScrollbar = (function() { 3796 function RondellScrollbar(container, options) { 3797 this.scrollRight = __bind(this.scrollRight, this); 3798 this.scrollLeft = __bind(this.scrollLeft, this); 3799 this.onScrollbarClick = __bind(this.onScrollbarClick, this); 3800 this.onDragStart = __bind(this.onDragStart, this); 3801 this.onDrag = __bind(this.onDrag, this); 3802 this.setPosition = __bind(this.setPosition, this); 3803 this.scrollTo = __bind(this.scrollTo, this); 3804 this.updatePosition = __bind(this.updatePosition, this); 3805 this._initControls = __bind(this._initControls, this); 3806 var scrollControlWidth; 3807 $.extend(true, this, $.rondell.defaults.scrollbar, options); 3808 this.container = container.addClass(classScrollbar); 3809 this._drag = { 3810 _dragging: false, 3811 _lastDragEvent: 0 3812 }; 3813 this.container.addClass("" + classScrollbar + "-" + this.orientation).css(this.style); 3814 this._initControls(); 3815 scrollControlWidth = this.scrollControl.outerWidth(); 3816 this._minX = this.padding + this.scrollLeftControl.outerWidth() + scrollControlWidth / 2; 3817 this._maxX = this.container.innerWidth() - this.padding - this.scrollRightControl.outerWidth() - scrollControlWidth / 2; 3818 this.setPosition(this.position, false, true); 3819 } 3820 3821 RondellScrollbar.prototype._initControls = function() { 3822 var scrollControlTemplate; 3823 scrollControlTemplate = "<div><span class=\"" + classScrollbarInner + "\"> </span></div>"; 3824 this.scrollLeftControl = $(scrollControlTemplate).addClass(classScrollbarLeft).click(this.scrollLeft); 3825 this.scrollRightControl = $(scrollControlTemplate).addClass(classScrollbarRight).click(this.scrollRight); 3826 this.scrollControl = $("<div class=\"" + classScrollbarControl + "\"> </div>").css("left", this.container.innerWidth() / 2).mousedown(this.onDragStart); 3827 this.scrollBackground = $("<div class=\"" + classScrollbarBackground + "\"/>"); 3828 this.container.append(this.scrollBackground, this.scrollLeftControl, this.scrollRightControl, this.scrollControl); 3829 return this.container.add(this.scrollBackground).click(this.onScrollbarClick); 3830 }; 3831 3832 RondellScrollbar.prototype.updatePosition = function(position, fireCallback) { 3833 if (fireCallback == null) { 3834 fireCallback = true; 3835 } 3836 if (!position || position === this.position || position < this.start || position > this.end) { 3837 return; 3838 } 3839 this.position = position; 3840 if (fireCallback) { 3841 return typeof this.onScroll === "function" ? this.onScroll(position, true) : void 0; 3842 } 3843 }; 3844 3845 RondellScrollbar.prototype.scrollTo = function(x, animate, fireCallback) { 3846 var newPosition; 3847 if (animate == null) { 3848 animate = true; 3849 } 3850 if (fireCallback == null) { 3851 fireCallback = true; 3852 } 3853 if (x < this._minX || x > this._maxX) { 3854 return; 3855 } 3856 this.scrollControl.stop(true).css('left', x); 3857 newPosition = Math.round((x - this._minX) / (this._maxX - this._minX) * (this.end
3857- this.start)) + this.start; 3858 if (newPosition !== this.position) { 3859 return this.updatePosition(newPosition, fireCallback); 3860 } 3861 }; 3862 3863 RondellScrollbar.prototype.setPosition = function(position, fireCallback, force) { 3864 var newX; 3865 if (fireCallback == null) { 3866 fireCallback = true; 3867 } 3868 if (force == null) { 3869 force = false; 3870 } 3871 if (this.repeating) { 3872 if (position < this.start) { 3873 position = this.end; 3874 } 3875 if (position > this.end) { 3876 position = this.start; 3877 } 3878 } 3879 if (!force && (position < this.start || position > this.end || position === this.position)) { 3880 return; 3881 } 3882 newX = Math.round((position - this.start) / (this.end - this.start) * (this._maxX - this._minX)) + this._minX; 3883 return this.scrollTo(newX, true, fireCallback); 3884 }; 3885 3886 RondellScrollbar.prototype.onDrag = function(e) { 3887 var newX, _ref; 3888 e.preventDefault(); 3889 if (!this._drag._dragging) { 3890 return; 3891 } 3892 if (e.type === "mouseup") { 3893 this._drag._dragging = false; 3894 this.scrollControl.removeClass(classScrollbarDragging); 3895 return $(window).unbind("mousemove mouseup", this.onDrag); 3896 } else { 3897 newX = 0; 3898 if ((_ref = this.orientation) === "top" || _ref === "bottom") { 3899 newX = e.pageX - this.container.offset().left; 3900 } else { 3901 newX = e.pageY - this.container.offset().top; 3902 } 3903 newX = Math.max(this._minX, Math.min(this._maxX, newX)); 3904 return this.scrollTo(newX, false); 3905 } 3906 }; 3907 3908 RondellScrollbar.prototype.onDragStart = function(e) { 3909 e.preventDefault(); 3910 this._drag._dragging = true; 3911 this.scrollControl.addClass(classScrollbarDragging); 3912 return $(window).bind("mousemove mouseup", this.onDrag); 3913 }; 3914 3915 RondellScrollbar.prototype.onScrollbarClick = function(e) { 3916 return this.scrollTo(e.pageX - this.container.offset().left); 3917 }; 3918 3919 RondellScrollbar.prototype.scrollLeft = function(e) { 3920 var newPosition; 3921 e.preventDefault(); 3922 newPosition = this.position - this.stepSize; 3923 if (this.keepStepOrder && this.stepSize > 1) { 3924 if (newPosition >= this.start) { 3925 newPosition -= (newPosition - this.start) % this.stepSize; 3926 } else if (this.repeating) { 3927 newPosition = this.start + Math.floor((this.end - this.start) / this.stepSize) * this.stepSize; 3928 } 3929 } 3930 return this.setPosition(newPosition); 3931 }; 3932 3933 RondellScrollbar.prototype.scrollRight = function(e) { 3934 var newPosition; 3935 e.preventDefault(); 3936 newPosition = this.position + this.stepSize; 3937 if (this.keepStepOrder && this.stepSize > 1) { 3938 newPosition -= (newPosition - this.start) % this.stepSize; 3939 if (this.repeating && newPosition > this.end) { 3940 newPosition = this.start; 3941 } 3942 } 3943 return this.setPosition(newPosition); 3944 }; 3945 3946 return RondellScrollbar; 3947 3948 })(); 3949 return $.fn.rondell = function(options, callback) { 3950 var self; 3951 if (options == null) { 3952 options = {}; 3953 } 3954 if (callback == null) { 3955 callback = void 0; 3956 } 3957 self = $(this); 3958 if (this.length > 1) { 3959 this.each(function() { 3960 return self.rondell(options, callback); 3961 }); 3962 } else if (self.data('rondell') === void 0) { 3963 new Rondell(this, options, callback); 3964 } else { 3965 self.data('rondell').update(options); 3966 } 3967 return this; 3968 }; 3969})(jQuery, window, document); 3970 3971/*! 3972 Presets for jQuery rondell plugin 3973 3974 @author Sebastian Helzle ([email protected] or @sebobo) 3975 @category jQuery plugin 3976 @copyright (c) 2009-2013 Sebastian Helzle (www.sebastianhelzle.net) 3977 @license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. 3978*/ 3979 3980(function($) { 3981 $.rondell || ($.rondell = {}); 3982 return $.rondell.presets = { 3983 carousel: { 3984 autoRotation: { 3985 enabled: true, 3986 direction: 1, 3987 once: false, 3988 delay: 5000 3989 }, 3990 radius: { 3991 x: 240, 3992 y: 50 3993 }, 3994 center: { 3995 left: 340, 3996 top: 160 3997 }, 3998 controls: { 3999 margin: { 4000 x: 130, 4001 y: 260 4002 } 4003 }, 4004 randomStart: true, 4005 currentLayer: 1, 4006 funcSize: function(l, r, i) { 4007 return 1 / Math.abs(l); 4008 } 4009 }, 4010 scroller: { 4011 repeating: false, 4012 alwaysShowCaption: true, 4013 visibleItems: 4, 4014 theme: "light", 4015 lightbox: { 4016 enabled: false 4017 }, 4018 itemProperties: { 4019 delay: 0, 4020 size: { 4021 width: 100, 4022 height: 200 4023 }, 4024 sizeFocused: { 4025 width: 300, 4026 height: 200 4027 } 4028 }, 4029 center: { 4030 left: 400, 4031 top: 100 4032 }, 4033 size: { 4034 width: 800, 4035 height: 200 4036 }, 4037 controls: { 4038 margin: { 4039 x: 210, 4040 y: 158 4041 } 4042 }, 4043 funcTop: function(l, r, i) { 4044 return 0; 4045 }, 4046 funcDiff: function(d, r, i) { 4047 return Math.abs(d) + 1; 4048 }, 4049 funcLeft: function(l, r, i) { 4050 return r.center.left + (l - 0.5) * r.itemProperties.size.width; 4051 }, 4052 funcOpacity: function(l, r, i) { 4053 return 0.8; 4054 } 4055 }, 4056 pages: { 4057 radius: { 4058 x: 0, 4059 y: 0 4060 }, 4061 lightbox: { 4062 enabled: false 4063 }, 4064 scaling: 1, 4065 theme: "page", 4066 visibleItems: 1, 4067 controls: { 4068 margin: { 4069 x: 0, 4070 y: 0 4071 } 4072 },
4073 strings: { 4074 prev: ' ', 4075 next: ' ' 4076 }, 4077 center: { 4078 left: 200, 4079 top: 200 4080 }, 4081 itemProperties: { 4082 size: { 4083 width: 400, 4084 height: 400 4085 } 4086 }, 4087 funcTop: function(l, r, i) { 4088 return r.center.top - r.itemProperties.size.height / 2; 4089 }, 4090 funcLeft: function(l, r, i) { 4091 return r.center.left + l * r.itemProperties.size.width; 4092 }, 4093 funcDiff: function(l, r, i) { 4094 return Math.abs(l) + 0.5; 4095 } 4096 }, 4097 cubic: { 4098 center: { 4099 left: 300, 4100 top: 200 4101 }, 4102 visibleItems: 5, 4103 itemProperties: { 4104 size: { 4105 width: 350, 4106 height: 350 4107 }, 4108 sizeFocused: { 4109 width: 350, 4110 height: 350 4111 } 4112 }, 4113 controls: { 4114 margin: { 4115 x: 70, 4116 y: 330 4117 } 4118 }, 4119 funcTop: function(l, r, i) { 4120 return r.center.top - r.itemProperties.size.height / 2 + Math.pow(l / 2, 3) * r.radius.x; 4121 }, 4122 funcLeft: function(l, r, i) { 4123 return r.center.left - r.itemProperties.size.width / 2 + Math.sin(l) * r.radius.x; 4124 }, 4125 funcSize: function(l, r, i) { 4126 return Math.pow((Math.PI - Math.abs(l)) / Math.PI, 3); 4127 } 4128 }, 4129 gallery: { 4130 special: { 4131 itemPadding: 2 4132 }, 4133 visibleItems: 7, 4134 theme: "light", 4135 cropThumbnails: false, 4136 center: { 4137 top: 145, 4138 left: 250 4139 }, 4140 size: { 4141 height: 400, 4142 width: 500 4143 }, 4144 controls: { 4145 margin: { 4146 x: 10, 4147 y: 255 4148 } 4149 }, 4150 itemProperties: { 4151 delay: 0, 4152 sizeFocused: { 4153 width: 480, 4154 height: 280 4155 }, 4156 size: { 4157 width: 80, 4158 height: 100 4159 } 4160 }, 4161 funcTop: function(l, r, i) { 4162 return r.size.height - r.itemProperties.size.height - r.special.itemPadding; 4163 }, 4164 funcDiff: function(d, r, i) { 4165 return Math.abs(d) - 0.5; 4166 }, 4167 funcLeft: function(l, r, i) { 4168 return r.center.left + (l - 0.5) * (r.itemProperties.size.width + r.special.itemPadding); 4169 }, 4170 funcOpacity: function(l, r, i) { 4171 return 0.8; 4172 } 4173 }, 4174 thumbGallery: { 4175 special: { 4176 columns: 3, 4177 rows: 3, 4178 groupSize: 9, 4179 itemPadding: 5, 4180 thumbsOffset: { 4181 x: 500, 4182 y: 0 4183 } 4184 }, 4185 visibleItems: 9, 4186 wrapIndices: false, 4187 currentLayer: 1, 4188 switchIndices: true, 4189 cropThumbnails: true, 4190 center: { 4191 top: 215, 4192 left: 250 4193 }, 4194 size: { 4195 height: 430, 4196 width: 800 4197 }, 4198 controls: { 4199 enabled: false, 4200 margin: { 4201 x: 10, 4202 y: 255 4203 } 4204 }, 4205 itemProperties: { 4206 delay: 40, 4207 sizeFocused: { 4208 width: 480, 4209 height: 420 4210 }, 4211 size: { 4212 width: 94, 4213 height: 126 4214 } 4215 }, 4216 scrollbar: { 4217 enabled: true, 4218 stepSize: 9, 4219 start: 2, 4220 style: { 4221 width: 292, 4222 right: 3, 4223 bottom: 5 4224 } 4225 }, 4226 funcDiff: function(d, r, i) { 4227 return Math.abs(d); 4228 }, 4229 funcOpacity: function(l, r, i) { 4230 var currentLayerIndex; 4231 currentLayerIndex = r.currentLayer > r._focusedItem.currentSlot ? r.currentLayer - 1 : r.currentLayer; 4232 if (i > r._focusedItem.currentSlot) { 4233 i--; 4234 } 4235 if (Math.floor((i - 1) / r.special.groupSize) === Math.floor((currentLayerIndex - 1) / r.special.groupSize)) { 4236 return 0.8; 4237 } else { 4238 return 0; 4239 } 4240 }, 4241 funcTop: function(l, r, i) { 4242 if (i > r._focusedItem.currentSlot) { 4243 i--; 4244 } 4245 return r.special.thumbsOffset.y + r.special.itemPadding + Math.floor(((i - 1) % r.special.groupSize) / r.special.rows) * (r.itemProperties.size.height + r.special.itemPadding); 4246 }, 4247 funcLeft: function(l, r, i) { 4248 var column, currentLayerIndex, groupOffset; 4249 currentLayerIndex = r.currentLayer > r._focusedItem.currentSlot ? r.currentLayer - 1 : r.currentLayer; 4250 if (i > r._focusedItem.currentSlot) { 4251 i--; 4252 } 4253 column = ((i - 1) % r.special.groupSize) % r.special.columns; 4254 groupOffset = Math.floor((i - 1) / r.special.groupSize) - Math.floor((currentLayerIndex - 1) / r.special.groupSize); 4255 return r.special.thumbsOffset.x + r.special.itemPadding + (column + r.special.columns * groupOffset) * (r.itemProperties.size.width + r.special.itemPadding); 4256 } 4257 }, 4258 slider: { 4259 theme: 'slider', 4260 visibleItems: 1, 4261 fadeTime: 1000, 4262 opacityMin: 0.01, 4263 autoRotation: { 4264 enabled: true 4265 }, 4266 center: { 4267 top: 150, 4268 left: 300 4269 }, 4270 size: { 4271 height: 300, 4272 width: 600 4273 }, 4274 controls: { 4275 margin: { 4276 x: -1, 4277 y: 135 4278 } 4279 },
4280 strings: { 4281 prev: '<span> </span>', 4282 next: '<span> </span>' 4283 }, 4284 itemProperties: { 4285 sizeFocused: { 4286 width: 600, 4287 height: 300 4288 }, 4289 size: { 4290 width: 600, 4291 height: 300 4292 } 4293 }, 4294 funcTop: function(l, r, i) { 4295 return 0; 4296 }, 4297 funcLeft: function(l, r, i) { 4298 return 0; 4299 }, 4300 funcOpacity: function(l, r, i) { 4301 return 0.02; 4302 } 4303 } 4304 }; 4305})(jQuery); 4306 4307/** 4308 * HTML5audioplayer â NIMIUS 4309 * @param {object} palyer the player object 4310 * @return {void} 4311 */ 4312function HTML5audioplayer(inp) { 4313 4314 this.settings = merge_options({ 4315 player: document.querySelector("#audio-wrap audio"), 4316 playClass: 'audio-controllerPlay', 4317 pauseClass: 'audio-controllerPause', 4318 nextClass: 'audio-controllerNext', 4319 prevClass: 'audio-controllerPrev', 4320 songSelector: '#audio-playlist .song', 4321 4322 knob: '#control .knob', 4323 time: '#control .time', 4324 4325 uploadFolder: 'uploads/tx_nimhtml5audioplayer/' 4326 }, inp); 4327 4328 4329 // =========================================== 4330 // Functions 4331 4332 // Controlling functions, use these to control the player 4333 4334 /** 4335 * starts the playback 4336 */ 4337 this.play = function () { 4338 this.setLabel(this.playlist.songs[this.playlist.currentSong]); 4339 this.player.play(); 4340 this.playButton.play(); 4341 } 4342 4343 /** 4344 * pauses the playback 4345 */ 4346 this.pause = function () { 4347 this.player.pause(); 4348 this.playButton.pause(); 4349 } 4350 4351 /** 4352 * toggles the play / pause state 4353 */ 4354 this.toggleplay = function () { 4355 if (this.player.paused) { 4356 this.play(); 4357 } else { 4358 this.pause(); 4359 } 4360 } 4361 4362 /** 4363 * i guess you can guess what this does 4364 */ 4365 this.next = function () { 4366 // see if the player was playing before 4367 var playing = !this.player.paused; 4368 this.setSong(this.playlist.next()); 4369 this.player.load(); 4370 4371 // if the player was playing before, then start playing again 4372 if (playing) { 4373 this.play(); 4374 } 4375 } 4376 4377 /** 4378 * i guess you can guess what this does 4379 */ 4380 this.prev = function () { 4381 // see if the player was playing before 4382 var playing = !this.player.paused; 4383 this.setSong(this.playlist.prev()); 4384 this.player.load(); 4385 4386 // if the player was playing before, then start playing again 4387 if (playing) { 4388 this.play(); 4389 } 4390 } 4391 4392 /** 4393 * skip to a certain time in the song 4394 * @param {number} time time in the song in seconds (must be lower than the total length of the song) 4395 */ 4396 this.setTime = function (time) { 4397 if (time < this.player.seekable.end(0)) { 4398 this.player.currentTime = time; 4399 } 4400 } 4401 4402 /** 4403 * sets the Volume 4404 * @param {number} vol the volume, between 0.0 (mute) and 1.0 (full) 4405 */ 4406 this.setVolume = function (vol) { 4407 this.player.volume = vol; 4408 4409 if (vol > 0 && vol < 1) { 4410 //console.log(this); 4411 this.knob.update(vol); 4412 } 4413 } 4414 4415 4416 // internal functions, unless you know what you are doing, don't use them from outwards 4417 4418 /** 4419 * sets the label for the song 4420 * @param {HTML5audioplayer.song} song 4421 */ 4422 this.setLabel = function (song) { 4423 var songs = document.querySelectorAll(this.settings.songSelector); 4424 for (var i = 0; i < songs.length; i++) { 4425 songs[i].className = "song"; 4426 } 4427 songs[song.id - 1].className = "song active"; 4428 } 4429 4430 /** 4431 * actually sets the song for us 4432 * @param {HTML5audioplayer.song} song a valid song object 4433 */ 4434 this.setSong = function (song) { 4435 var out = ""; 4436 if (song.mp3) { 4437 //out += '<source src="' + this.settings.uploadFolder + '/' + song.mp3 + '" data-title="' + song.name + '" type="audio/mpeg" preload="auto" />' 4438 out += '<source src="/userspace/' + song.mp3 + '" data-title=' + song.name + '" type="audio/mpeg" preload="auto" />' 4439 } 4440 if (song.ogg) { 4441 out += '<source src="' + this.settings.uploadFolder + '/' + song.ogg + '" data-title="' + song.name + '" type="audio/ogg" preload="auto" />' 4442 } 4443 //console.log(this.player); 4444 this.player.innerHTML = out; 4445 this.setLabel(song); 4446 this.playlist.currentSong = song.id; 4447 } 4448 4449 /** 4450 * gets the progress of the song 4451 * @param {boolean} convertToPercent should be true, if you want percentages (0%-100%), if false it returns floats (0.0 - 1.0) 4452 * @returns {number} 4453 */ 4454 this.getPercentage = function (convertToPercent) { 4455 var time = this.player.currentTime / this.player.seekable.end(0); 4456 if(convertToPercent){ 4457 time *= 100; 4458 } 4459 return time; 4460 } 4461 4462 /** 4463 * sets the rimerunner to the current position in the song 4464 */ 4465 this.updateTime = function () { 4466 if (!this.player.paused && this.getPercentage() != 0) { 4467 this.timerunner.update( 4468 this.getPercentage() 4469 ); 4470 } 4471 //console.log(this); 4472 } 4473 4474 /** 4475 * binds the updateTime function to an interval every second 4476 * @param {boolean} bind if true it sets the interval, if false it removes / clears it 4477 */ 4478 this.bindTimeUpdate = function (bind) { 4479 if (bind) { 4480 this.timeUpdateInterval = setInterval(this.updateTime.bind(this), 100); 4481 } else { 4482 clearInterval(this.timeUpdateInterval); 4483 } 4484 } 4485 4486 /** 4487 * Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1 4488 * http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically 4489 * 4490 * @param obj1 4491 * @param obj2 4492 * @returns obj3 a new object based on obj1 and obj2 4493 */ 4494 function merge_options(obj1, obj2) { 4495 var obj3 = {}; 4496 for (var attrname in obj1) { 4497 obj3[attrname] = obj1[attrname]; 4498 } 4499 for (var attrname in obj2) { 4500 obj3[attrname] = obj2[attrname]; 4501 } 4502 return obj3; 4503 } 4504 4505 4506 // 4507 // =============================================== 4508 // initialization 4509 4510 // for easier use later on and no scope confusion in the handlers 4511 HTML5audioplayer = this; 4512 4513 // sets the player object / element 4514 // you can input both: a already selected audio element or a selector 4515 this.player = (typeof(this.settings.player) == "object") ? this.settings.player : document.querySelector(this.settings.player); 4516 4517 // initialize the play button 4518 this.playButton = new playButton({ 4519 button: '.' + this.settings.playClass, 4520 play: this.settings.playClass, 4521 pause: this.settings.pauseClass 4522 }); 4523 4524 // initialize the playlist object 4525 this.playlist = new playlist(this.settings.songSelector); 4526 4527 // set the first song note here: this array starts at 1, cause starting at 0 causes trouble 4528 this.setSong(this.playlist.songs[1]); 4529 4530 // sets the next and prev button 4531 this.nextButton = document.querySelector('.' + this.settings.nextClass); 4532 this.prevButton = document.querySelector('.' + this.settings.prevClass); 4533 4534 // initializes the volume knob 4535 this.knob = new jimKnopf({ 4536 knob: this.settings.knob 4537 }); 4538 4539 // sets the volume to full volume by default 4540 this.setVolume(0.999); 4541 4542 // initialize the timerunner 4543 this.timerunner = new jimKnopf({ 4544 knob: this.settings.time, 4545 thickness: 50 4546 }); 4547 4548 this.timerunner.update(0); 4549 4550 // bind the update 4551 this.bindTimeUpdate(true); 4552 4553 4554 4555 4556 4557 4558 // ================================================ 4559 // event handler 4560 4561 this.playButton.button.onclick = function () { 4562 HTML5audioplayer.toggleplay(); 4563 } 4564 4565 this.nextButton.onclick = function () { 4566 HTML5audioplayer.next(); 4567 } 4568 4569 this.prevButton.onclick = function () { 4570 HTML5audioplayer.prev(); 4571 } 4572 4573 this.knob.element.onchange = function () { 4574 HTML5audioplayer.setVolume(this.value); 4575 }; 4576 4577 this.timerunner.element.onchange = function () { 4578 // first unbind the automatic update every second to avoid the control "jumping around" and pausing the player for the same reason 4579 HTML5audioplayer.bindTimeUpdate(false); 4580 HTML5audioplayer.pause(); 4581 4582 // set the actual value (the input ranges from 0.0 to 1.0, so we have to multiply by the total length of the song to get the seconds) 4583 HTML5audioplayer.setTime(this.value * HTML5audioplayer.player.seekable.end(0)); 4584 4585 // start playing again after 1second 4586 setTimeout(function () { 4587 HTML5audioplayer.play(); 4588 }, 1000); 4589 4590 // bind the timerunner update again 4591 HTML5audioplayer.bindTimeUpdate(true); 4592 } 4593
4594 this.player.onended = function(){ 4595 HTML5audioplayer.next(); 4596 HTML5audioplayer.play(); 4597 } 4598 4599 4600 4601 4602 4603 // ============================================== 4604 // Objects 4605 4606 4607 /** 4608 * The Song object 4609 * @param {object} inp object input in the type of {mp3: ⦠ogg: ⦠name: â¦} 4610 * @return {void} 4611 */ 4612 function song(inp) { 4613 if (inp.mp3) this.mp3 = inp.mp3; 4614 if (inp.ogg) this.ogg = inp.ogg; 4615 if (inp.name) this.name = inp.name; 4616 if (inp.id) this.id = inp.id; 4617 //console.log(inp); 4618 } 4619 4620 /** 4621 * the play button 4622 * @param {object} inp 4623 */ 4624 function playButton(inp) { 4625 this.button = (typeof(inp.button) == "object") ? inp.button : document.querySelector(inp.button); 4626 this.playClass = inp.play; 4627 this.pauseClass = inp.pause; 4628 this.playing; 4629 4630 this.pause = function () { 4631 this.button.setAttribute("class", this.playClass); 4632 this.playing = false; 4633 } 4634 4635 this.play = function () { 4636 this.button.setAttribute("class", this.pauseClass); 4637 this.playing = true; 4638 } 4639 } 4640 4641 4642 /** 4643 * Playlist object 4644 * @return {void} 4645 */ 4646 function playlist(songSelector) { 4647 playlist = this; 4648 4649 this.currentSong = 1; 4650 // build the actual playlist 4651 this.songs = [ 4652 {} 4653 ]; 4654 4655 var s = document.querySelectorAll(songSelector); 4656 for (var i = 0; i < s.length; i++) { 4657 4658 var id = i + 1; 4659 4660 this.songs.push(new song({ 4661 name: s[i].getAttribute("data-name") ? s[i].getAttribute("data-name") : false, 4662 mp3: s[i].getAttribute("data-mp3") ? s[i].getAttribute("data-mp3") : false, 4663 ogg: s[i].getAttribute("data-ogg") ? s[i].getAttribute("data-ogg") : false, 4664 id: id 4665 })); 4666 s[i].setAttribute("data-id", id); 4667 4668 s[i].onclick = function () { 4669 //console.log(this) 4670 4671 // do not update while changing the song. 4672 // That can result in timpolling while reloading the content 4673 HTML5audioplayer.bindTimeUpdate(false); 4674 HTML5audioplayer.timerunner.update(0); 4675 4676 HTML5audioplayer.setSong(playlist.songs[this.getAttribute("data-id")]); 4677 HTML5audioplayer.player.load(); 4678 HTML5audioplayer.play(); 4679 4680 setInterval(HTML5audioplayer.bindTimeUpdate(true),1000); 4681 } 4682 } 4683 4684 4685 /** 4686 * next function: increases current counter and returns the new song object 4687 * @return {HTML5audioplayer.song} 4688 */ 4689 this.next = function () { 4690 var nextSong; 4691 if (this.currentSong + 1 < this.songs.length) { 4692 nextSong = this.currentSong + 1; 4693 } else { 4694 nextSong = 1; 4695 } 4696 4697 this.currentSong = nextSong; 4698 return this.songs[nextSong]; 4699 } 4700 4701 /** 4702 * prev function: decreases the current counter and returns the new song object 4703 * @return {HTML5audioplayer.song} 4704 */ 4705 this.prev = function () { 4706 var prevSong; 4707 if (this.currentSong - 1 >= 1) { 4708 prevSong = this.currentSong - 1; 4709 } else { 4710 prevSong = this.songs.length - 1; 4711 } 4712 4713 this.currentSong = prevSong; 4714 //console.log(["nextSong in playlist.prev d()",prevSong]); 4715 return this.songs[prevSong]; 4716 } 4717 } 4718 4719 4720 /** 4721 * a wrapper for the turning knob library jim knopf 4722 * @param inp 4723 */ 4724 function jimKnopf(inp) { 4725 4726 /* 4727 initialization 4728 */ 4729 this.element = (typeof(inp.knob) == "object") ? inp.knob : document.querySelector(inp.knob); 4730 4731 /** 4732 * default for thickness 4733 */ 4734 if (!inp.thickness) { 4735 inp.thickness = 15; 4736 } 4737 4738 /** 4739 * as taken from one of the examples on the site 4740 */ 4741 P3 = function() {}; 4742 P3.prototype = Object.create(Ui.prototype); 4743 4744 P3.prototype.createElement = function() { 4745 Ui.prototype.createElement.apply(this, arguments); 4746 this.addComponent(new Ui.Arc({ 4747 arcWidth: this.width/inp.thickness 4748 }));
4749 this.merge(this.options, {arcWidth: this.width/inp.thickness}); 4750 var arc = new Ui.El.Arc(this.options); 4751 arc.setAngle(this.options.anglerange); 4752 this.el.node.appendChild(arc.node); 4753 }; 4754 4755 4756 this.jim = new Knob(this.element, new P3()); 4757 4758 /** 4759 * update the state of the knob 4760 * @param {number} num either a float between 0.0 - 1.0 or percentage between 0% - 100% 4761 * @param {boolean} isPercent if true, it indicates, that the given value is to treat as a percentage 4762 */ 4763 this.update = function (num, isPercent) { 4764 if (typeof isPercent !== "undefined" || isPercent) { 4765 num /= 100; 4766 } 4767 this.jim.ui.update(num); 4768 } 4769 4770 4771 } 4772 4773} 4774 4775 4776 4777var Knob; 4778Knob = function (input, ui) { 4779 var container = document.createElement('div'); 4780 container.setAttribute('tabindex', 0); 4781 input.parentNode.replaceChild(container, input); 4782 input.style.cssText = 'position: absolute; top: -10000px'; 4783 input.setAttribute('tabindex', -1); 4784 container.appendChild(input); 4785 4786 var settings = this.settings = this._getSettings(input); 4787 4788 4789 this.value = input.value = settings.min + settings.range / 2; 4790 this.input = input; 4791 this.min = settings.min; 4792 4793 this.ui = ui; 4794 input.addEventListener('change', this.changed.bind(this), false); 4795 4796 var events = { 4797 keydown: this._handleKeyEvents.bind(this), 4798 mousewheel: this._handleWheelEvents.bind(this), 4799 DOMMouseScroll: this._handleWheelEvents.bind(this), 4800 touchstart: this._handleMove.bind(this, 'touchmove', 'touchend'), 4801 mousedown: this._handleMove.bind(this, 'mousemove', 'mouseup'), 4802 click: this._updateWhileMoving.bind(this) 4803 }; 4804 4805 for (var event in events) { 4806 container.addEventListener(event, events[event], false); 4807 } 4808 4809 container.style.cssText = 'position: absolute; width:' + settings.width + 'px;' + 'height:' + settings.height + 'px;'; 4810 container.className = settings.class; 4811 4812 ui.init(container, settings); 4813 4814 4815 this.container = container; 4816 this.changed(0); 4817 4818}; 4819 4820Knob.prototype = { 4821 _handleKeyEvents: function (e) { 4822 var keycode = e.keyCode; 4823 if (keycode >= 37 && keycode <= 40) { 4824 e.preventDefault(); 4825 var f = 1 + e.shiftKey * 9; 4826 this.changed({37: -1, 38: 1, 39: 1, 40: -1}[keycode] * f); 4827 } 4828 }, 4829 4830 _handleWheelEvents: function (e) { 4831 e.preventDefault(); 4832 var deltaX = -e.detail || e.wheelDeltaX; 4833 var deltaY = -e.detail || e.wheelDeltaY; 4834 var val = deltaX > 0 || deltaY > 0 ? 1 : deltaX < 0 || deltaY < 0 ? -1 : 0; 4835 this.changed(val); 4836 }, 4837 4838 _handleMove: function (onMove, onEnd) { 4839 /* 4840 function getOffsetTop(element){ 4841 if(element.parentElement){ 4842 //if(element.offsetTop !== element.parentNode.offsetTop){ 4843 console.log(element.offsetTop,element.getBoundingClientRect().top,element); 4844 4845 return element.offsetTop + getOffsetTop(element.parentElement); 4846 //} 4847 } 4848 return element.offsetTop; 4849 } 4850 4851 function getOffsetLeft(element){ 4852 if(element.parentElement){ 4853 return element.offsetLeft + getOffsetLeft(element.parentElement); 4854 } 4855 return element.offsetLeft; 4856 } 4857 */ 4858 4859 4860 var rect = this.container.getBoundingClientRect(); 4861 4862 this.centerX = rect.left + this.settings.width / 2; 4863 this.centerY = rect.top + document.querySelector("body").scrollTop + this.settings.height / 2; 4864 console.log([rect.top, this.centerY]); 4865 var fnc = this._updateWhileMoving.bind(this); 4866 var body = document.body; 4867 body.addEventListener(onMove, fnc, false); 4868 body.addEventListener(onEnd, function () { 4869 body.removeEventListener(onMove, fnc, false); 4870 }, false); 4871 }, 4872 4873 _updateWhileMoving: function (event) { 4874 event.preventDefault(); 4875 var e = event.changedTouches ? event.changedTouches[0] : event; 4876 var x = this.centerX - e.pageX; 4877 var y = this.centerY - e.pageY; 4878 var deg = Math.atan2(-y, -x) * 180 / Math.PI + 90 - this.settings.angleoffset; 4879 var percent; 4880 4881 if (deg < 0) { 4882 deg += 360; 4883 } 4884 deg = deg % 360; 4885 if (deg <= this.settings.anglerange) { 4886 percent = Math.max(Math.min(1, deg / this.settings.anglerange), 0); 4887 } else { 4888 percent = +(deg - this.settings.anglerange < (360 - this.settings.anglerange) / 2); 4889 } 4890 var range = this.settings.range; 4891 //console.log([this.min,range,percent,this.settings]); 4892 var value = this.min + range * percent; 4893 4894 var step = this.input.step; 4895 //console.log(["value",value,"step",step]) 4896 this.value = this.input.value = Math.round(value / step) * step; 4897 this.ui.update(percent, this.value); 4898 4899 if (typeof(this.input.onchange) == "function") { 4900 this.input.onchange(); 4901 } 4902 4903 }, 4904 4905 changed: function (direction) { 4906 this.input.value = this.limit(parseFloat(this.input.value) + direction * (this.input.step || 1)); 4907 this.value = this.input.value; 4908 this.ui.update(this._valueToPercent(), this.value); 4909 if (typeof(this.input.onchange) == "function") { 4910 this.input.onchange(); 4911 } 4912 }, 4913 4914 _valueToPercent: function () { 4915 return this.value != null ? 100 / this.settings.range * (this.value - this.min) / 100 : this.min; 4916 }, 4917 4918 limit: function (value) { 4919 return Math.min(Math.max(this.settings.min, value), this.settings.max); 4920 }, 4921 _getSettings: function (input) { 4922 var settings = { 4923 max: parseFloat(input.max), 4924 min: parseFloat(input.min), 4925 step: parseFloat(input.step) || 1, 4926 multiplier: 3, 4927 angleoffset: 0, 4928 anglerange: 360 4929 }; 4930 settings.range = settings.max - settings.min; 4931 var data = input.dataset; 4932 for (var i in data) { 4933 if (data.hasOwnProperty(i)) { 4934 var value = +data[i]; 4935 settings[i] = isNaN(value) ? data[i] : value; 4936 } 4937 } 4938 return settings; 4939 } 4940}; 4941 4942 4943 4944var Ui = function() { 4945}; 4946 4947Ui.prototype = { 4948 init: function(parentEl, options) { 4949 this.options || (this.options = {});
4950 this.merge(this.options, options); 4951 this.width = options.width; 4952 this.height = options.height; 4953 this.createElement(parentEl); 4954 if (!this.components) { 4955 return; 4956 } 4957 this.components.forEach(function(component) { 4958 component.init(this.el.node, options); 4959 }.bind(this)); 4960 }, 4961 4962 merge: function(dest, src) { 4963 for (var i in src) { 4964 if (src.hasOwnProperty(i)) { 4965 dest[i] = src[i]; 4966 } 4967 } 4968 return dest; 4969 }, 4970 4971 addComponent: function(component) { 4972 this.components || (this.components = []); 4973 this.components.push(component); 4974 }, 4975 4976 update: function(percent, value) { 4977 4978 if (!this.components) { 4979 return; 4980 } 4981 this.components.forEach(function(component) { 4982 component.update(percent, value); 4983 }); 4984 }, 4985 4986 createElement: function(parentEl) { 4987 this.el = new Ui.El(this.width, this.height); 4988 this.el.create("svg", { 4989 version: "1.2", 4990 baseProfile: "tiny", 4991 width: this.width, 4992 height: this.height 4993 }); 4994 this.appendTo(parentEl); 4995 }, 4996 appendTo: function(parent) { 4997 parent.appendChild(this.el.node); 4998 } 4999 5000}; 5001 5002Ui.Pointer = function(options) { 5003 this.options = options || {}; 5004 this.options.type && Ui.El[this.options.type] || (this.options.type = 'Triangle'); 5005}; 5006 5007Ui.Pointer.prototype = Object.create(Ui.prototype); 5008 5009Ui.Pointer.prototype.update = function(percent) { 5010 this.el.rotate(this.options.angleoffset + percent * this.options.anglerange, this.width / 2, 5011 this.height / 2); 5012}; 5013 5014Ui.Pointer.prototype.createElement = function(parentEl) { 5015 this.options.pointerHeight || (this.options.pointerHeight = this.height / 2); 5016 if (this.options.type == 'Arc') { 5017 this.el = new Ui.El.Arc(this.options); 5018 this.el.setAngle(this.options.size); 5019 } else { 5020 this.el = new Ui.El[this.options.type](this.options.pointerWidth, 5021 this.options.pointerHeight, this.width / 2, 5022 this.options.pointerHeight / 2 + this.options.offset); 5023 } 5024 this.appendTo(parentEl); 5025 5026}; 5027 5028Ui.Arc = function(options) { 5029 this.options = options || {}; 5030}; 5031 5032Ui.Arc.prototype = Object.create(Ui.prototype); 5033 5034Ui.Arc.prototype.createElement = function(parentEl) { 5035 this.el = new Ui.El.Arc(this.options); 5036 this.appendTo(parentEl); 5037}; 5038 5039Ui.Arc.prototype.update = function(percent) { 5040 this.el.setAngle(percent * this.options.anglerange); 5041}; 5042 5043Ui.Scale = function(options) { 5044 this.options = this.merge({ 5045 steps: options.range / options.step, 5046 radius: this.width / 2, 5047 tickWidth: 1, 5048 tickHeight: 3 5049 }, options); 5050 this.options.type = Ui.El[this.options.type || 'Rect']; 5051}; 5052 5053Ui.Scale.prototype = Object.create(Ui.prototype); 5054 5055Ui.Scale.prototype.createElement = function(parentEl) { 5056 this.el = new Ui.El(this.width, this.height); 5057 this.startAngle = this.options.angleoffset || 0; 5058 this.options.radius || (this.options.radius = this.height / 2.5); 5059 this.el.create("g"); 5060 this.el.addClassName('scale'); 5061 if (this.options.drawScale) { 5062 var step = this.options.anglerange / this.options.steps; 5063 var end = this.options.steps + (this.options.anglerange == 360 ? 0 : 1); 5064 this.ticks = []; 5065 var Shape = this.options.type; 5066 for (var i = 0; i < end; i++) { 5067 var rect = new Shape(this.options.tickWidth, this.options.tickHeight, this.width / 2, 5068 this.options.tickHeight / 2); 5069 rect.rotate(this.startAngle + i * step, this.width / 2, this.height / 2); 5070 this.el.append(rect); 5071 this.ticks.push(rect); 5072 } 5073 } 5074 this.appendTo(parentEl); 5075 if (this.options.drawDial) { 5076 this.dial(); 5077 } 5078}; 5079 5080Ui.Scale.prototype.dial = function() { 5081 var step = this.options.anglerange / this.options.steps; 5082 var min = this.options.min; 5083 var dialStep = (this.options.max - min) / this.options.steps; 5084 var end = this.options.steps + (this.options.anglerange == 360 ? 0 : 1); 5085 this.dials = []; 5086 for (var i = 0; i < end; i++) { 5087 var text = new Ui.El.Text(Math.abs(min + dialStep * i), this.width / 2 - 2.5, 5088 this.height / 2 - this.options.radius, 5, 5); 5089 this.el.append(text); 5090 text.rotate(this.startAngle + i * step, this.width / 2, this.height / 2); 5091 this.dials.push(text); 5092 } 5093}; 5094 5095Ui.Scale.prototype.update = function(percent) { 5096 if (this.ticks) { 5097 if (this.activeStep) { 5098 this.activeStep.attr('class', ''); 5099 } 5100 this.activeStep = this.ticks[Math.round(this.options.steps * percent)]; 5101 this.activeStep.attr('class', 'active'); 5102 } 5103 if (this.dials) { 5104 if (this.activeDial) { 5105 this.activeDial.attr('class', ''); 5106 } 5107 this.activeDial = this.dials[Math.round(this.options.steps * percent)]; 5108 if (this.activeDial) { 5109 this.activeDial.attr('class', 'active'); 5110 } 5111 } 5112}; 5113 5114Ui.Text = function() {}; 5115 5116Ui.Text.prototype = Object.create(Ui.prototype); 5117 5118Ui.Text.prototype.createElement = function(parentEl) { 5119 this.parentEl = parentEl 5120 this.el = new Ui.El.Text('', 0, this.height); 5121 this.appendTo(parentEl); 5122 this.el.center(parentEl); 5123}; 5124 5125Ui.Text.prototype.update = function(percent, value) { 5126 this.el.node.textContent = value; 5127 this.el.center(this.parentEl); 5128}; 5129 5130Ui.El = function() {}; 5131 5132Ui.El.prototype = { 5133 svgNS: "http://www.w3.org/2000/svg", 5134 5135 init: function(width, height, x, y) { 5136 this.width = width; 5137 this.height = height; 5138 this.x = x || 0; 5139 this.y = y || 0; 5140 this.left = this.x - width / 2; 5141 this.right = this.x + width / 2; 5142 this.top = this.y - height / 2; 5143 this.bottom = this.y + height / 2; 5144 }, 5145 create: function(type, attributes) { 5146 this.node = document.createElementNS(this.svgNS, type); 5147 for (var key in attributes) { 5148 this.attr(key, attributes[key]); 5149 } 5150 }, 5151 5152 rotate: function(angle, x, y) { 5153 this.attr("transform", "rotate(" + angle + " " + (x || this.x) + " " + (y || this.y ) + ")"); 5154 }, 5155 5156 attr: function(attributeName, value) { 5157 if (value == null) return this.node.getAttribute(attributeName) || ''; 5158 this.node.setAttribute(attributeName, value); 5159 }, 5160 5161 append: function(el) { 5162 this.node.appendChild(el.node); 5163 }, 5164 5165 addClassName: function(className) { 5166 this.attr('class', this.attr('class') + ' ' + className); 5167 } 5168}; 5169 5170Ui.El.Triangle = function() { 5171 this.init.apply(this, arguments); 5172 this.create("polygon", { 5173 'points': this.left + ',' + this.bottom + ' ' + this.x + ',' + this.top + ' ' + this.right + ',' + this.bottom 5174 }); 5175}; 5176 5177Ui.El.Triangle.prototype = Object.create(Ui.El.prototype); 5178 5179Ui.El.Rect = function() { 5180 this.init.apply(this, arguments); 5181 this.create("rect", { 5182 x: this.x - this.width / 2, 5183 y: this.y, 5184 width: this.width, 5185 height: this.height 5186 }); 5187}; 5188 5189Ui.El.Rect.prototype = Object.create(Ui.El.prototype); 5190 5191Ui.El.Circle = function(radius, x, y) { 5192 if (arguments.length == 4) { 5193 x = arguments[2]; 5194 y = arguments[3]; 5195 } 5196 this.init(radius * 2, radius * 2, x, y); 5197 this.create("circle", { 5198 cx: this.x, 5199 cy: this.y,
5200 r: radius 5201 }); 5202}; 5203 5204Ui.El.Circle.prototype = Object.create(Ui.El.prototype); 5205 5206Ui.El.Text = function(text, x, y, width, height) { 5207 this.create('text', { 5208 x: x, 5209 y: y, 5210 width: width, 5211 height: height 5212 }); 5213 this.node.textContent = text; 5214}; 5215 5216Ui.El.Text.prototype = Object.create(Ui.El.prototype); 5217 5218Ui.El.Text.prototype.center = function(element) { 5219 var width = element.getAttribute('width'); 5220 var height = element.getAttribute('height'); 5221 this.attr('x', width / 2 - this.node.getBBox().width / 2); 5222 this.attr('y', height / 2 + this.node.getBBox().height / 4); 5223}; 5224 5225Ui.El.Arc = function(options) { 5226 this.options = options; 5227 this.options.angleoffset = (options.angleoffset || 0) - 90; 5228 this.create('path'); 5229}; 5230 5231Ui.El.Arc.prototype = Object.create(Ui.El.prototype); 5232 5233Ui.El.Arc.prototype.setAngle = function(angle) { 5234 this.attr('d', this.getCoords(angle)); 5235}; 5236 5237 5238Ui.El.Arc.prototype.getCoords = function(angle) { 5239 var startAngle = this.options.angleoffset; 5240 var outerRadius = this.options.outerRadius || this.options.width / 2; 5241 var innerRadius = this.options.innerRadius || this.options.width / 2 - this.options.arcWidth; 5242 var startAngleDegree = Math.PI * startAngle / 180; 5243 var endAngleDegree = Math.PI * (startAngle + angle) / 180; 5244 var center = this.options.width / 2; 5245 5246 var p1 = pointOnCircle(outerRadius, endAngleDegree); 5247 var p2 = pointOnCircle(outerRadius, startAngleDegree); 5248 var p3 = pointOnCircle(innerRadius, startAngleDegree); 5249 var p4 = pointOnCircle(innerRadius, endAngleDegree); 5250 5251 var path = 'M' + p1.x + ',' + p1.y; 5252 var largeArcFlag = ( angle < 180 ? 0 : 1); 5253 path += ' A' + outerRadius + ',' + outerRadius + ' 0 ' + largeArcFlag + ' 0 ' + p2.x + ',' + p2.y; 5254 path += 'L' + p3.x + ',' + p3.y; 5255 path += ' A' + innerRadius + ',' + innerRadius + ' 0 ' + largeArcFlag + ' 1 ' + p4.x + ',' + p4.y; 5256 path += 'L' + p1.x + ',' + p1.y; 5257 return path; 5258 5259 function pointOnCircle(radius, angle) { 5260 return { 5261 x: center + radius * Math.cos(angle), 5262 y: center + radius * Math.sin(angle) 5263 }; 5264 } 5265}; 5266 5267$(document).ready(function () { 5268 if($('.tx-typo3forum-pi1').length){ // FBO 5269 // forum_last_post_summary 5270 var postSummarys = []; 5271 var postSummarysCount = 0; 5272 5273 $('.post_summary_box').each(function (index) { 5274 postSummarys[postSummarysCount] = {}; 5275 postSummarys[postSummarysCount]['type'] = $(this).data('type'); 5276 postSummarys[postSummarysCount]['hiddenimage'] = $(this).data('hiddenimage'); 5277 postSummarys[postSummarysCount]['uid'] = $(this).data('uid'); 5278 postSummarysCount = postSummarysCount + 1; 5279 }); 5280 5281 // onlinepoint 5282 var displayedUser = []; 5283 var displayedUserCount = 0; 5284 $('.user_onlinepoint').each(function (index) { 5285 displayedUser[displayedUserCount] = $(this).data('uid'); 5286 displayedUserCount = displayedUserCount + 1; 5287 }); 5288 5289 // topicIcons 5290 var displayedTopicIcons = []; 5291 var displayedTopicIconsCount = 0; 5292 $('.topic_icon').each(function (index) { 5293 displayedTopicIcons[displayedTopicIconsCount] = $(this).data('uid'); 5294 displayedTopicIconsCount = displayedTopicIconsCount + 1; 5295 }); 5296 5297 // forumIcons 5298 var displayedForumIcons = []; 5299 var displayedForumIconsCount = 0; 5300 $('.forum_icon').each(function (index) { 5301 displayedForumIcons[displayedForumIconsCount] = $(this).data('uid'); 5302 displayedForumIconsCount = displayedForumIconsCount + 1; 5303 }); 5304 5305 // forumMenus 5306 var displayedForumMenus = []; 5307 var displayedForumMenusCount = 0; 5308 $('.forum_menu').each(function (index) { 5309 displayedForumMenus[displayedForumMenusCount] = $(this).data('uid'); 5310 displayedForumMenusCount = displayedForumMenusCount + 1; 5311 }); 5312 5313 5314 // topicIcons 5315 var displayedTopics = []; 5316 var displayedTopicsCount = 0; 5317 $('.topic_entry').each(function (index) { 5318 displayedTopics[displayedTopicsCount] = $(this).data('uid'); 5319 displayedTopicsCount = displayedTopicsCount + 1; 5320 }); 5321 5322 var displayOnlinebox = 0; 5323 if($('.user_online_box').length > 0){ 5324 displayOnlinebox = 1; 5325 } 5326 5327 // post_item 5328 var displayedPosts = []; 5329 var displayedPostCount = 0; 5330 $('.post_item').each(function (index) { 5331 displayedPosts[displayedPostCount] = $(this).data('uid'); 5332 displayedPostCount = displayedPostCount + 1; 5333 }); 5334 5335 5336 // ads 5337 var displayedAds = {}; 5338 var displayedAdsIteration = 0; 5339 $('.ad-topic').each(function (index) {
5340 displayedAdsIteration = displayedAdsIteration + 1; 5341 }); 5342 $('.ad-topicdetail').each(function (index) { 5343 displayedAdsIteration = displayedAdsIteration + 1; 5344 }); 5345 displayedAds['count'] = displayedAdsIteration; 5346 displayedAds['mode'] = 0; 5347 $('.userInfo').each(function (index) { 5348 displayedAds['mode'] = 1; 5349 5350 }); 5351 5352 5353 $.ajax({ 5354 type: "POST", 5355 url: "index.php?id="+currentPageUid+"&eID=typo3_forum&language=de&tx_typo3forum_ajax[controller]=Ajax&tx_typo3forum_ajax[action]=main&tx_typo3forum_ajax[format]=json", 5356 async: true, 5357 data: { 5358 "tx_typo3forum_ajax[displayedUser]": JSON.stringify(displayedUser), 5359 "tx_typo3forum_ajax[postSummarys]": JSON.stringify(postSummarys), 5360 "tx_typo3forum_ajax[topicIcons]": JSON.stringify(displayedTopicIcons), 5361 "tx_typo3forum_ajax[forumIcons]": JSON.stringify(displayedForumIcons), 5362 "tx_typo3forum_ajax[displayedTopics]": JSON.stringify(displayedTopics), 5363 "tx_typo3forum_ajax[displayOnlinebox]": JSON.stringify(displayOnlinebox), 5364 "tx_typo3forum_ajax[displayedForumMenus]": JSON.str
5364ingify(displayedForumMenus), 5365 "tx_typo3forum_ajax[displayedPosts]": JSON.stringify(displayedPosts), 5366 "tx_typo3forum_ajax[displayedAds]": JSON.stringify(displayedAds) 5367 }, 5368 success: function (data) { 5369 var json = $.parseJSON(data); 5370 if(json.topicIcons){ 5371 json.topicIcons.forEach(function (entry) { 5372 $('.topic_icon[data-uid="' + entry.uid + '"]').html(entry.html); 5373 }); 5374 } 5375 if(json.forumMenus){ 5376 json.forumMenus.forEach(function (entry) { 5377 $('.forum_menu[data-uid="' + entry.uid + '"]').html(entry.html); 5378 }); 5379 }if(json.forumIcons){ 5380 json.forumIcons.forEach(function (entry) { 5381 $('.forum_icon[data-uid="' + entry.uid + '"]').html(entry.html); 5382 }); 5383 } 5384 if(json.postSummarys){ 5385 json.postSummarys.forEach(function (entry) { 5386 $('.post_summary_box[data-uid="' + entry.uid + '"][data-type="' + entry.type + '"]').html(entry.html); 5387 }); 5388 } 5389 if(json.topics){ 5390 json.topics.forEach(function (entry) { 5391 $('.topic_reply_count[data-uid="' + entry.uid + '"]').html(entry.replyCount); 5392 $('.topic_list_menu[data-uid="' + entry.uid + '"]').html(entry.topicListMenu); 5393 }); 5394 } 5395 if(json.posts){ 5396 json.posts.forEach(function (entry) { 5397 $('.postHelpfulCount_'+entry.uid+'').html(entry.postHelpfulCount); 5398 $('.postUserHelpfulCount_'+entry.author.uid+'').html(entry.postUserHelpfulCount); 5399 $('.post_helpful_button[data-uid="' + entry.uid + '"]').html(entry.postHelpfulButton); 5400 $('.post_edit_link[data-uid="' + entry.uid + '"]').html(entry.postEditLink); 5401 }); 5402 } 5403 if (json.onlineUser) { 5404 json.onlineUser.forEach(function (entry) { 5405 $('.user_onlinepoint[data-uid="' + entry+ '"]').removeClass('iconset-14-user-offline'); 5406 $('.user_onlinepoint[data-uid="' + entry+'"]').addClass('iconset-14-user-online'); 5407 }); 5408 } 5409 if (json.onlineBox) { 5410 $('.user_online_box .items').html(json.onlineBox.html); 5411 $('.user_online_count').html(json.onlineBox.count); 5412 } 5413 5414 if (json.ads) { 5415 if ($('#infomation-' + json.ads.position).length > 0) { 5416 $('#infomation-' + json.ads.position).html(json.ads.html).show(); 5417 } 5418 } 5419 5420 $('.tx-typo3forum-helpfull-btn').click(function () { 5421 var targetElement = this; 5422 var counttargetVal = $('.' + $(targetElement).attr('data-counttarget')).html(); 5423 var countusertargetVal = $('.' + $(targetElement).attr('data-countusertarget')).html(); 5424 var type = 'add'; 5425 if ($(targetElement).hasClass('supported')) { 5426 type = 'remove'; 5427 } 5428 $.ajax({ 5429 type: "GET", 5430 url: "index.php?id="+currentPageUid+"&eID=" + $(this).attr('data-eid') + "&tx_typo3forum_ajax[controller]=Post&tx_typo3forum_ajax[action]=" + type + "Supporter&tx_typo3forum_ajax[post]=" + $(this).attr('data-post'), 5431 async: false, 5432 beforeSend: function (msg) { 5433 $('.' + $(targetElement).attr('data-counttarget')).html('<div class="tx-typo3forum-ajax-loader"></div>'); 5434 $('.' + $(targetElement).attr('data-countusertarget')).html('<div class="tx-typo3forum-ajax-loader"></div>'); 5435 }, 5436 success: function (data) { 5437 var json = $.parseJSON(data); 5438 if (json.error) { 5439 $('.' + $(targetElement).attr('data-counttarget')).html(counttargetVal); 5440 $('.' + $(targetElement).attr('data-countusertarget')).html(countusertargetVal); 5441 return 5442 } 5443 if (type == 'add') { 5444 $(targetElement).addClass('supported'); 5445 } else { 5446 if ($(targetElement).hasClass('supported')) { 5447 $(targetElement).removeClass('supported'); 5448 } 5449 } 5450 $('.' + $(targetElement).attr('data-counttarget')).html(json.postHelpfulCount); 5451 $('.' + $(targetElement).attr('data-countusertarget')).html(json.userHelpfulCount); 5452 } 5453 }); 5454 }); 5455 } 5456 }); 5457 } 5458 5459}); 5460 5461 5462
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.