;(function($,_,undefined){"use strict";ips.controller.register('downloads.front.view.changeLog',{initialize:function(){this.on('menuItemSelected',this.changeVersion);this.setup();History.Adapter.bind(window,'statechange',_.bind(this.stateChange,this));},setup:function(){History.replaceState({controller:'changelog'},document.title,window.location.href);},changeVersion:function(e,data){data.originalEvent.preventDefault();var url=data.menuElem.find('[data-ipsMenuValue="'+data.selectedItemID+'"] > a').attr('href');History.pushState({controller:'changelog',version:data.selectedItemID},document.title,url);this._loadVersion(url,data.menuElem.find('[data-ipsMenuValue="'+data.selectedItemID+'"]').attr('data-changelogTitle'));},stateChange:function(){var state=History.getState();if(state.data.controller!='changelog'){return;} var item;if(state.data.version){item=$('#elChangelog_menu').find('[data-ipsMenuValue="'+state.data.version+'"]');}else{item=$('#elChangelog_menu').find('[data-ipsMenuValue]').first();} this._loadVersion(item.find('a').attr('href'),item.attr('data-ipsMenuValue'));},_loadVersion:function(url,versionTitle){var self=this;this.scope.find('[data-role="versionTitle"]').text(versionTitle);this.scope.find('[data-role="changeLogData"]').css({height:this.scope.find('[data-role="changeLogData"]').height()+'px'}).addClass('ipsLoading').html('');ips.getAjax()(url).done(function(response){self.scope.find('[data-role="changeLogData"]').html(response).removeClass('ipsLoading').css({height:'auto'});ips.utils.lazyLoad.loadContent(self.scope.find('[data-role="changeLogData"]'));}).fail(function(jqXHR,textStatus,errorThrown){window.location=url;});}});}(jQuery,_));; ;(function($,_,undefined){"use strict";ips.controller.register('downloads.front.view.download',{initialize:function(){this.on('click','[data-action="dialogClose"]',this.closeDialog);this.on('click','[data-action="selectFile"]',this.selectFile);this.on('click','[data-action="download"]',this.doDownload);},selectFile:function(e){var url=$(e.currentTarget).attr('href');var self=this;e.preventDefault();this.scope.html('').css({height:'250px'}).addClass('ipsLoading');ips.getAjax()(url).done(function(response){self.scope.html(response).css({height:'auto'}).removeClass('ipsLoading');}).fail(function(jqXHR,textStatus,errorThrown){window.location=url;});},closeDialog:function(e){e.preventDefault();this._closeDialog($(e.currentTarget).attr('href'));},_closeDialog:function(href){if(this.scope.closest('.ipsDialog').length){this.scope.closest('.ipsDialog').trigger('closeDialog');}else{window.location=href;}},doDownload:function(e){var that=this;if($(e.currentTarget).attr('data-wait')){e.preventDefault();ips.getAjax()($(e.currentTarget).attr('href')).done(function(response){var secondsRemaining=response.download-response.currentTime;$(e.currentTarget).hide().siblings().find('[data-role="downloadCounter"]').html(secondsRemaining).end().end().siblings('[data-role="downloadCounterContainer"]').removeClass('ipsHide');var interval=setInterval(function(){secondsRemaining--;$(e.currentTarget).siblings().find('[data-role="downloadCounter"]').html(secondsRemaining);if(secondsRemaining===0){clearInterval(interval);window.location=$(e.currentTarget).attr('href');that.scope.closest('.ipsDialog').trigger('closeDialog');}},1000);}).fail(function(){window.location=$(e.currentTarget).attr('href');})} else{this.scope.closest('.ipsDialog').trigger('closeDialog');}}});}(jQuery,_));; ;(function($,_,undefined){"use strict";ips.controller.register('downloads.front.view.subscribe',{ajaxObj:null,initialize:function(){this.on('click','[data-action="subscribe"]',this.toggle);},toggle:function(e){e.preventDefault();var self=this;var clicked=$(e.currentTarget);clicked.addClass('ipsFaded ipsFaded_more');ips.getAjax()(clicked.attr('href')).done(function(response){if(!response.error){if(response=='unsubscribed'){clicked.removeClass('ipsButton_primary');clicked.addClass('ipsButton_link');clicked.text(ips.getString('file_subscribe'));} else{clicked.addClass('ipsButton_primary');clicked.removeClass('ipsButton_link');clicked.text(ips.getString('file_unsubscribe'));}}}).always(function(){clicked.removeClass('ipsFaded ipsFaded_more');});}});}(jQuery,_));;