1var Calendar={};Calendar.Event={};Calendar.Event.Coordinates={};Calendar.Event.Coordinates.PreSubmitHandler=Class.extend({_form:null,_locationInput:null,init:function(a){this._locationInput=a;this._form=$("#messageContainer").submit($.proxy(this._submit,this))},_submit:function(a){if(this._form.data("geocodingCompleted")){return true}if(!$("#enableCoordinates").is(":checked")){return true}var b=$.trim($("#geocode").val());if(!b){WCF.Location.GoogleMaps.Util.reverseGeocoding($.proxy(this._reverseGeocoding,this),this._locationInput.getMarker());a.preventDefault();return false}this._setCoordinates()},_reverseGeocoding:function(a){if(a===null){$("#enableCoordinates").prop("checked",false)}else{$("#geocode").val(a)}this._setCoordinates();this._form.trigger("submit")},_setCoordinates:function(){var a=this._form.find(".formSubmit");$('<input type="hidden" name="latitude" value="'+this._locationInput.getMarker().getPosition().lat()+'" />').appendTo(a);$('<input type="hidden" name="longitude" value="'+this._locationInput.getMarker().getPosition().lng()+'" />').appendTo(a);this._form.data("geocodingCompleted",true)}});Calendar.Event.Preview=WCF.Popover.extend({_proxy:null,init:function(){this._super(".calendarEventLink");this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false});WCF.DOMNodeInsertedHandler.addCallback("Calendar.Event.Preview",$.proxy(this._initContainers,this))},_loadContent:function(){var b=$("#"+this._activeElementID);this._proxy.setOption("data",{actionName:"getEventPreview",className:"calendar\\data\\event\\date\\EventDateAction",objectIDs:[b.data("eventDateID")]});var c=this._activeElementID;var a=this;this._proxy.setOption("success",function(e,f,d){a._insertContent(c,e.returnValues.template,true)});this._proxy.sendRequest()}});Calendar.Event.Date={};Calendar.Event.Date.FullDay=Class.extend({_date:{end:"",start:""},_time:{end:"",start:""},_input:{end:null,start:null},_timezone:null,_isFullDay:null,init:function(){this._date={end:"",start:""};this._time={end:"",start:""};this._timezone=null;
1this._isFullDay=$("#isFullDay").change($.proxy(this._change,this));this._input={end:$("#endTime"),start:$("#startTime")};this._change(null,true)},_change:function(b,d){if(this._timezone===null){var e=this._input.end.datepicker("getDate").getTimezoneOffset();this._timezone=(e<0)?"+":"-";e=Math.abs(e);var c=Math.floor(e/60).toString();var a=(e%60).toString();if(c.length===1){c="0"+c}if(a.length===1){a="0"+a}this._timezone+=c+":"+a}if(this._isFullDay.is(":checked")){this._toggle("end",false);this._toggle("start",false)}else{if(d!==true){this._toggle("end",true);this._toggle("start",true)}else{if(d){this._bindOnClose()}}}if(this._isFullDay.is(":checked")){$("#timezone").parents("dl").hide()}else{$("#timezone").parents("dl").show()}},_toggle:function(f,d){var b=this._input[f].data("datepicker");var a=this._input[f].datepicker("getDate");var e=(b.selectedMonth+1).toString();if(e.length===1){e="0"+e}var c=b.selectedDay.toString();if(c.length===1){c="0"+c}this._date[f]=b.selectedYear+"-"+e+"-"+c;if(!d){var g=a.getHours().toString();if(g.length===1){g="0"+g}var i=a.getMinutes().toString();if(i.length===1){i="0"+i}this._time[f]=g+":"+i+":00"}var h=this._date[f];if(d){h+="T"+this._time[f]+this._timezone}this._input[f].datepicker("destroy").val(h).attr("type","date"+(d?"time":"")).removeClass("jsDatePicker");WCF.DOMNodeInsertedHandler.execute();if(f=="start"){this._bindOnClose()}},_bindOnClose:function(){var b=this._input.start.datepicker("option","onClose");var a=this;this._input.start.datepicker("option","onClose",function(f,d){var e=new Date(a._input.start.datepicker("getDate")).getTime();var c=new Date(a._input.end.datepicker("getDate")).getTime();if(e>c){a._input.end.datepicker("setDate",new Date(e+(3600*1000)))}b(f,d)})}});Calendar.Event.Date.Participation={};Calendar.Event.Date.Participation.Manager=Class.extend({_comment:"",_companions:0,_decision:"",_dialog:null,_event:{maxCompanions:0,maxParticipants:0,participationIsChangeable:0,},_eventDate:{participants:0},_eventDateID:0,_eventDateParticipation:{decision:"",companions:0},_proxy:null,_ui:{container:{companions:null,decision:null,message:null},element:{companions:null,decision:null,message:null}},init:function(a){this._comment="";this._companions=0;this._decision="";this._event={maxCompanions:0,maxParticipants:0,participationIsChangeable:0,};this._eventDate={participants:0};this._eventDateID=a;this._eventDateParticipation={companions:0,decision:""};this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)});this._ui={container:{companions:null,decision:null,message:null},element:{companions:null,decision:null,inviteUsernames:null,message:null}};$(".jsCalendarButtonParticipation").click($.proxy(this._click,this))},_click:function(){this._proxy.setOption("data",{actionName:"getParticipationForm",className:"calendar\\data\\event\\date\\EventDateAction",objectIDs:[this._eventDateID]});this._proxy.sendRequest()},_success:function(b,c,a){switch(b.actionName){case"getParticipationForm":this._initDialog(b);break;case"save":$("#calendarParticipationContainer").html(b.returnValues.template);new WCF.System.Notification().show();this._dialog.wcfDialog("close");break}},_failure:function(b,a,d,c){if(b===null||this._dialog===null||b.returnValues===undefined||b.returnValues.fieldName===undefined){return true}switch(b.returnValues.fieldName){case"invitedUsernames":$('<small class="innerError">'+b.returnValues.errorType+"</small>").appendTo(this._ui.element.inviteUsernames.parents("dd"));break}return false},_initDialog:function(e){var a=false;if(this._dialog===null){this._dialog=$("<div />").html(e.returnValues.template).hide().appendTo(document.body);a=true}else{this._dialog.html(e.returnValues.template)}this._ui={container:{companions:$("#eventDateParticipationCompanionsContainer"),decision:$("#eventDateParticipationDecisionContainer"),message:$("#eventDateParticipationMessageContainer")},element:{companions:$("#eventDateParticipationCompanions"),decision:$("#eventDateParticipationDecision"),inviteUsernames:$("#eventDateInviteUsernames"),message:$("#eventDateParticipationMessage")}};$('<div class="formSubmit"><button>
1'+WCF.Language.get("wcf.global.button.submit")+"</button></div>").appendTo(this._dialog);this._dialog.find("button").click($.proxy(this._submit,this));this._event={maxCompanions:parseInt(e.returnValues.event.maxCompanions),maxParticipants:parseInt(e.returnValues.event.maxParticipants),participationIsChangeable:parseInt(e.returnValues.event.participationIsChangeable),};this._eventDate={participants:parseInt(e.returnValues.eventDate.participants)};this._eventDateParticipation={companions:(e.returnValues.participation)?Math.max(e.returnValues.participation.participants-1,0):0,decision:(e.returnValues.participation)?e.returnValues.participation.decision:""};this._companions=this._eventDateParticipation.companions;this._decision=this._eventDateParticipation.decision;this._message=(e.returnValues.participation)?e.returnValues.participation.message:"";var c=(this._event.maxParticipants-this._eventDate.participants)-this._companions;if(!this._event.maxParticipants){c=999}var d=Math.max(Math.min(this._event.maxCompanions,c),this._eventDateParticipation.companions);this._ui.element.companions.val(this._companions).prop("max",d);this._ui.element.decision.val(this._decision);this._ui.element.message.val(this._message);if(!this._event.participationIsChangeable&&this._decision=="yes"){$("<small>"+WCF.Language.get("calendar.event.date.participation.notChangeable")+"</small>").insertAfter(this._ui.element.companions);$("<small>"+WCF.Language.get("calendar.event.date.participation.notChangeable")+"</small>").insertAfter(this._ui.element.decision);var b=this._ui.element.decision.children("option:checked").text();this._ui.element.decision.replaceWith(b);this._ui.element.companions.replaceWith(this._companions)}else{this._ui.element.companions.blur($.proxy(this._validateCompanions,this));this._ui.element.decision.change($.proxy(this._updateDecision,this))}if(a){this._dialog.wcfDialog({title:WCF.Language.get("calendar.event.date.participation")})}else{this._dialog.wcfDialog("open")}this._updateDecision()},_updateDecision:function(){this._decision=this._ui.element.decision.val();this._ui.container.companions.hide();this._ui.container.message.hide();switch(this._decision){case"yes":if(this._event.maxCompanions){this._ui.container.companions.show()}this._ui.container.message.show();break;case"maybe":if(this._event.maxCompanions){this._ui.container.companions.show()}break}this._dialog.wcfDialog("render")},_submit:function(){this._validate();this._dialog.find("small.innerError").remove();var a="";if(this._dialog.find("input[name=eventDateParticipationUsername]:checked").val()==1){a=$.trim($("#eventDateParticipationUsernameSearchField").val())}this._proxy.setOption("data",{actionName:"save",className:"calendar\\data\\event\\date\\EventDateAction",objectIDs:[this._eventDateID],parameters:{companions:this._ui.element.companions.val(),decision:this._ui.element.decision.val(),invitedUsernames:this._ui.element.inviteUsernames.val(),message:$.trim(this._ui.element.message.val()),username:a}});this._proxy.sendRequest()},_validateCompanions:function(){var b=parseInt(this._ui.element.companions.prop("max"));var a=parseInt(this._ui.element.companions.val());var c=this._ui.element.companions.parent();if(b<a){c.children("small.innerError").remove();$('<small class="innerError">'+WCF.Language.get("calendar.event.date.participation.companions.error.exceededMaxCompanions")+"</small>").appendTo(c);c.parent().addClass("formError")}else{if(a<0){this._ui.element.companions.val(0)}c.children("small.innerError").remove();c.parent().removeClass("formError")}},_validate:function(){var a=this._ui.element.decision.val();if(a==="yes"||a==="maybe"){var b=parseInt(this._ui.element.companions.prop("max"));if(b<parseInt(this._ui.element.companions.val())){this._ui.element.companions.val(b)}}else{this._ui.element.companions.val(0)}if(a!=="yes"){this._ui.element.message.val("")}}});Calendar.Event.Date.Participation.RemoveParticipant=WCF.Action.Delete.extend({init:function(){this._super("calendar\\data\\event\\date\\participation\\EventDateParticipationAction",".jsParticipant")},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"removeParticipant",className:this._className,objectIDs:[$(a).data("objectID")]});
1this.proxy.sendRequest()},_success:function(c,h,b){var g=c.returnValues.participationID;for(var a in this._containers){var f=$("#"+this._containers[a]);if(f.find(".jsDeleteButton").data("objectID")==g){var d=f.parent();f.remove();if(!d.children("li").length){var e=d.parents("fieldset");d=e.parent();e.remove();if(!d.children("fieldset").length){d.remove()}}}}}});Calendar.Event.InlineEditor=WCF.InlineEditor.extend({_redirectURL:"",setRedirectURL:function(a){this._redirectURL=a},_setOptions:function(){this._options=[{label:WCF.Language.get("calendar.event.enable"),optionName:"enable"},{label:WCF.Language.get("calendar.event.disable"),optionName:"disable"},{label:WCF.Language.get("calendar.event.trash"),optionName:"trash"},{label:WCF.Language.get("calendar.event.restore"),optionName:"restore"},{label:WCF.Language.get("calendar.event.delete"),optionName:"delete"},{optionName:"divider"},{label:WCF.Language.get("wcf.global.button.edit"),optionName:"edit",isQuickOption:true}]},_show:function(c){var d=$(c.currentTarget).data("elementID");var a=null;if(!this._dropdowns[d]){a=this._getTriggerElement(this._elements[d]).addClass("dropdownToggle").parent().addClass("dropdown").end();this._dropdowns[d]=$('<ul class="dropdownMenu" />').insertAfter(a)}this._super(c);if(a!==null){WCF.Dropdown.initDropdown(a,true);var b=a.parent().wcfIdentify();WCF.Dropdown.registerCallback(b,$.proxy(this._toggleDropdown,this));this._toggleDropdown(b,"open")}return false},_toggleDropdown:function(a,b){WCF.Dropdown.getDropdown(a).parents(".messageOptions").toggleClass("forceOpen")},_getTriggerElement:function(a){return a.find(".jsButtonEventInlineEditor")},_validate:function(a,c){var b=$("#"+a);switch(c){case"delete":if(!b.data("canDeleteEvent")){return false}if(b.data("isDeleted")){return true}break;case"restore":if(!b.data("canRestoreEvent")){return false}if(b.data("isDeleted")){return true}break;case"trash":if(!b.data("canTrashEvent")){return false}if(!b.data("isDeleted")){return true}break;case"enable":case"disable":if(!b.data("canModerateEvent")){return false}if(b.data("isDeleted")){return false}if(b.data("isDisabled")){return(c==="enable")}else{return(c==="disable")}break;case"edit":if(!b.data("canEditEvent")){return false}return true;break}return false},_execute:function(a,c){if(!this._validate(a,c)){return false}switch(c){case"disable":case"enable":this._updateEvent(a,c,{isDisabled:(c==="enable"?0:1)});break;case"delete":var b=this;WCF.System.Confirmation.show(WCF.Language.get("calendar.event.delete.confirmMessage"),function(d){if(d==="confirm"){b._updateEvent(a,c,{deleted:1})}});break;case"edit":window.location=this._getTriggerElement($("#"+a)).prop("href");break;case"restore":this._updateEvent(a,c,{isDeleted:0});break;case"trash":var b=this;WCF.System.Confirmation.show(WCF.Language.get("calendar.event.trash.confirmMessage"),function(d){if(d==="confirm"){b._updateEvent(a,c,{isDeleted:1,reason:$("#wcfSystemConfirmationContent").find("textarea").val()})}},{},$("<fieldset><dl><dt>"+WCF.Language.get("calendar.event.trash.reason")+'</dt><dd><textarea cols="40" rows="4" /></dd></dl></fieldset>'));break}},_updateEvent:function(b,d,e){if(d==="delete"){var c=this;var a=this._elements[b].data("objectID");new WCF.Action.Proxy({autoSend:true,data:{actionName:"delete",className:"calendar\\data\\event\\EventAction",objectIDs:[a]},success:function(f){if(c._redirectURL){window.location=c._redirectURL}else{window.location.reload()}}})}else{this._updateData.push({data:e,elementID:b,optionName:d});this._proxy.setOption("data",{actionName:d,className:"calendar\\data\\event\\EventAction",objectIDs:[this._elements[b].data("objectID")],parameters:{data:e}});this._proxy.sendRequest()}},_updateState:function(){if(this._updateData.length==1&&this._updateData[0].optionName=="trash"&&!this._elements[this._updateData[0].elementID].data("canViewDeletedEvent")){this._notification.show($.proxy(function(){window.location=this._redirectURL},this));return}this._notification.show();for(var d=0,c=this._updateData.length;d<c;d++){var b=this._updateData[d];var a=$("#"+b.elementID);switch(b.optionName){case"disable":case"enable":a.toggleClass("messageDisabled").data("isDisabled",b.data.isDisabled);break;case"restore":case"trash":a.toggleClass("messageDeleted").data("isDeleted",b.data.isDeleted);break}}}});Calendar.Event.Like=WCF.Like.extend({_getContainers:function(){return $("article")},_getObjectID:function(a){return this._containers[a].data("objectID")},_getWidgetContainer:function(a){return this._containers[a].find(".messageHeader")},_buildWidget:function(b,a,e,d,f){var g=this._getWidgetContainer(b);if(this._canLike){var c=this._containers[b].find(".smallButtons");a.insertBefore(c.find(".toTopLink"));e.insertBefore(c.find(".toTopLink"));e.find("a").addClass("button");a.find("a").addClass("button")}if(f){f.appendTo(this._containers[b].find(".messageBody > .messageFooter"));f.addClass("messageFooterNote")}g.find(".permalink").after(d)}
1,_setActiveState:function(a,b,c){a=a.find(".button").removeClass("active");b=b.find(".button").removeClass("active");if(c==1){a.addClass("active")}else{if(c==-1){b.addClass("active")}}},_addWidget:function(a,b){}});Calendar.Event.TabMenu={selectErroneousTab:function(){$(".tabMenuContent").each(function(a,b){var c=$(b);if(c.find(".formError").length){c.parents(".tabMenuContainer").wcfTabs("selectTab",c.wcfIdentify());return false}})}};Calendar.Event.QuoteHandler=WCF.Message.Quote.Handler.extend({init:function(a){this._super(a,"calendar\\data\\event\\EventAction","com.woltlab.calendar.event",".message",".messageBody",".messageBody > div > div.messageText")}});Calendar.Event.List=Class.extend({_cache:{},_dialog:null,_proxy:null,_titles:{},init:function(){this._dialog=null;this._cache={};this._titles={};$(".jsCalendarDay").click($.proxy(this._click,this));this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_click:function(b){var a=$(b.currentTarget);var c=a.data("date");if(this._cache[c]){this._render(c)}else{this._titles[c]=a.data("overlayTitle");this._proxy.setOption("data",{actionName:"getEventList",className:"calendar\\data\\event\\date\\EventDateAction",parameters:{date:c}});this._proxy.sendRequest()}},_render:function(a){if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.html(this._cache[a]).wcfDialog({title:this._titles[a]})}else{this._dialog.html(this._cache[a]);this._dialog.wcfDialog("option","title",this._titles[a]);this._dialog.wcfDialog("open");this._dialog.wcfDialog("render")}},_success:function(b,c,a){this._cache[b.returnValues.date]=b.returnValues.template;this._render(b.returnValues.date)}});Calendar.UI={};Calendar.UI.Calendar={_listItems:null,init:function(){this._listItems=$(".calendarFullMonthView > .calendarWeeks > li");enquire.register("screen and (max-width: 800px)",{match:$.proxy(this._enable,this),unmatch:$.proxy(this._disable,this)})},_enable:function(){this._listItems.each(function(c,b){var a=$(b);a.children("div").each(function(e,f){var d=$(f);d.data("__originalValue",d.text());d.text(d.prop("title"));d.click(function(){a.toggleClass("open")})});a.find("> .calendarWeekDays > li > h3").each(function(d,f){var e=$(f);e.data("__originalValue",e.text());e.find("a").text(e.data("fullDay"))});if(a.find(".calendarToday").length==1){a.addClass("open")}})},_disable:function(){this._listItems.each(function(c,b){var a=$(b).removeClass("open");a.children("div").each(function(e,f){var d=$(f);d.text(d.data("__originalValue")).off("click")});a.find("> .calendarWeekDays > li > h3").each(function(d,f){var e=$(f);e.find("a").text(e.data("__originalValue"))})})}};Calendar.Map={};Calendar.Map.LargeMap=WCF.Location.GoogleMaps.LargeMap.extend({_success:function(c,f,b){if(c.returnValues&&c.returnValues.markers){for(var e=0,d=c.returnValues.markers.length;e<d;e++){var a=c.returnValues.markers[e];this.addMarker(a.latitude,a.longitude,a.title,null,a.infoWindow,a.dialog,a.location);if(a.objectID){this._objectIDs.push(a.objectID)}else{if(a.objectIDs){this._objectIDs=this._objectIDs.concat(a.objectIDs)}}}}},addMarker:function(c,a,e,d,f,b,g){var h=$(f).get(0);var i=this._super(c,a,e,d,h);if(b){google.maps.event.addListener(i.infoWindow,"domready",$.proxy(function(){new Calendar.Map.InfoWindowEventListDialog($(h).find(".jsCalendarLocationDialogEventListButton"),b,g)},this))}return i.infoWindow}});Calendar.Map.InfoWindowEventListDialog=Class.extend({_dialog:null,_dialogContent:"",_eventData:[],init:function(b,c,a){this._dialogContent=c;this._location=a;b.click($.proxy(this._click,this))},_click:function(){if(this._dialog===null){this._dialog=$("<div />").append(this._dialogContent).hide().appendTo(document.body).wcfDialog({title:WCF.Language.get(this._location)})}else{this._dialog.wcfDialog("open")}}});
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.