PageSourceSearch

https://www.wienerwirtschaft.com/system/modules/ncmPackages/assets/ncm.prices_frontend.js

js wienerwirtschaft.com collected 2026-10-05 22:12:00 UTC 11,169 bytes, 297 lines download raw bytes

1// which site are we on?
2var siteType = false;
3
4var pricelistRoomSearch = {
5    
6    selected_date : false,
7    
8    ids : "",
9    category_ids : "",
10    
11    wrapper : false,
12    
13    // search parameters
14    order_by : false,
15    order_type : false,
16	
17	detailpage_id : false,
18    language: "de",
19    
20    init : function() {
21    
22        this.wrapper = jQuery(".ncm_prices_list_wrapper");
23
24        this.selected_date = this.wrapper.attr("data-selected");
25        this.detailpage_id = this.wrapper.attr("data-detailpage-id");
26        this.ids = this.wrapper.attr("data-ids");
27        this.category_ids = this.wrapper.attr("data-category-ids");
28
29        if (jQuery("html").attr("lang")) {
30            this.language = jQuery("html").attr("lang");
31        }
32		
33        this.wrapper.on("change", "select[name=order]", jQuery.proxy(function(event) {
34			// show all rooms on changing search criteria
35			this.wrapper.find(".show_all_rooms").attr("data-selected", "0");
36			this.search();
37            this.wrapper.find(".show_all_rooms").remove();
38        }, this));
39        
40        this.wrapper.on("click", ".show_all_rooms a", function(event) {
41            event.stopPropagation();
42            jQuery(this).closest(".show_all_rooms").attr("data-selected", "0");
43            pricelistRoomSearch.search({ message: CONTAO_LANGUAGE.ncmPriceList.room_all_ajax_text });
44            jQuery(this).closest(".show_all_rooms").remove();
45            return false;
46        });
47
48        // this is not a search but also a live handler
49        this.wrapper.on("click", ".item_room .item_choose", function(event) {
50            // is this already selected?
51            if (jQuery(this).attr("data-selected") == 1) {
52                // unselect this
53                jQuery(this).attr("data-selected", "0").find("img").attr("src", jQuery(this).data("not-selected-img"));
54                jQuery(this).find("span.select-text").text(jQuery(this).find("span.select-text").data("not-selected-text"));
55                // hide the anfrage button
56                jQuery(this).closest(".item_room").find(".enquiry_text").slideUp();
57            } else {
58                // select this
59                jQuery(this).attr("data-selected", "1").find("img").attr("src", jQuery(this).data("selected-img"));
60                jQuery(this).find("span.select-text").text(jQuery(this).find("span.select-text").data("selected-text"));
61                // show the anfrage button
62                jQuery(this).closest(".item_room").find(".enquiry_text").slideDown();
63            }
64            
65            // remove all other selecteds
66            //jQuery(this).closest(".selection_rooms").find(".item_room .item_choose").attr("data-selected", "0").find("img").attr("src", jQuery(this).data("not-selected-img"));
67            
68            // update selected
69            var selected = [];
70            jQuery(this).closest(".selection_rooms").find(".item_room .item_choose").filter(function() {
71                return jQuery(this).attr("data-selected") == "1";  
72            }).each(function() {
73                selected.push(jQuery(this).closest(".item_room").attr("data-id"));
74            });
75            jQuery(this).closest(".selection_rooms").attr("data-selected", selected.join(","));
76        });
77        
78        // show all text
79        this.wrapper.find(".show_all_rooms a").text(jQuery("#room_result_count").attr("data-text"));
80        
81        // update selected rooms
82        this.wrapper.find(".selection_rooms").attr("data-selected", function() {
83            var selected = [];
84            jQuery(this).find(".item_choose").filter(function() {
85                return jQuery(this).attr("data-selected") == "1";  
86            }).each(function() {
87                selected.push(jQuery(this).closest(".item_room").attr("data-id"));
88            });
89            return selected.join(",");
90        });
91    },
92    
93    search : function(params) {
94        
95        // default
96        if (typeof params == "undefined") {
97            params = {};
98        }
99        
100        // setup search parameters
101        // order
102        var order = this.wrapper.find("select[name=order]:visible").val() || ""; 
103        var matches;
104        if (matches = order.match(/sort_([a-z]+)_([a-z]+)/)) {
105            this.order_by = matches[1];
106            this.order_type = matches[2];
107        }
108        this.wrapper.find(".selection_rooms").addClass("loading");
109        
110        this.limit = this.wrapper.find(".show_all_rooms").attr("data-selected") || "0";
111        
112        this.selected_date = this.wrapper.attr("data-selected");        
113        
114        // loading indicator
115        try {
116            var message = typeof params.message != "undefined" ? params.message : CONTAO_LANGUAGE.ncmPriceList.room_ajax_text;
117            		jQuery.blockUI({
118                            message : '<div class="message"><div class="loader"></div><br />
118 ' + CONTAO_LANGUAGE.ncmRoomDetails.room_ajax_text + '</div>'
119            
120                    });
121        } catch(e) {
122        }
123        
124        //this.wrapper.find(".selection_rooms .item_room").remove();
125        //debug("@TODO: ajax");
126        jQuery.ajax({
127            type: "GET",
128            url: "fe/prices?_action=search_season_rooms",
129            data: {
130                date_index : this.selected_date,
131                order_by : this.order_by ? this.order_by : "",
132                order_type : this.order_type ? this.order_type : "",
133                limit : this.limit,
134                selected: this.wrapper.find(".selection_rooms").attr("data-selected"),
135				detailpage_id : this.detailpage_id,
136                language : this.language,
137                ids : this.ids,
138                category_ids : this.category_ids
139            },
140            cache: false,
141            // @TODO: error handling
142            success: jQuery.proxy(function(data){
143                
144                // check where to insert the new content
145                if (this.wrapper.find(".selection_rooms .sort").size()) {
146                    var afterElement = this.wrapper.find(".selection_rooms .sort");
147                } else if (this.wrapper.find(".selection_rooms > h2,.selection_rooms > h3,.selection_rooms > h4,.selection_rooms > .h4,.selection_rooms > .h3,.selection_rooms > .h2").size()) {
148                    var afterElement = this.wrapper.find(".selection_rooms > h2,.selection_rooms > h3,.selection_rooms > h4,.selection_rooms > .h4,.selection_rooms > .h3,.selection_rooms > .h2").last();   
149                }
150                
151                // update content
152                this.wrapper.find("#room_result_count").remove();
153                this.wrapper.find(".selection_rooms .item_room").remove();
154                
155                // insert new content
156                if (typeof afterElement != "undefined" && afterElement) {
157                    afterElement.after(data);    
158                } else {
159                    this.wrapper.find(".selection_rooms").prepend(data);
160                }
161
162                // update total button
163                this.wrapper.find(".show_all_rooms a").text(jQuery("#room_result_count").attr("data-text"));
164                
165                // update selected rooms
166                this.wrapper.find(".selection_rooms").attr("data-selected", function() {
167                    var selected = [];
168                    jQuery(this).find(".item_choose").filter(function() {
169                        return jQuery(this).attr("data-selected") == "1";  
170                    }).each(function() {
171                        selected.push(jQuery(this).closest(".item_room").attr("data-id"));
172                    });
173                    return selected.join(",");
174                });
175
176                // reset selected 
177                //this.wrapper.find(".selection_rooms").attr("data-selected", "");
178                
179                // remove loading
180                this.wrapper.find(".selection_rooms").removeClass("loading");
181                
182                // loading
183                try {
184                    jQuery.unblockUI();
185                } catch (e) {
186                    
187                }
188                
189            }, this)
190        });
191    }
192};
193
194jQuery(function() {
195    
196    // set sitetype
197    switch (true) {
198        
199        case (jQuery(".ncm_prices_list_wrapper").size() > 0): // price list
200            siteType = "pricelist";
201            break;
202
203        default: // don't contiunue
204            return false;
205    }
206    
207	// store list url in cookie
208	if (siteType == "pricelist") {
209		// store the selected date index in a cookie
210		jQuery.cookie("room_list_url_" + jQuery("html").attr("lang"), window.location, {path:'/'});
211	}
212    
213    // init search
214    pricelistRoomSearch.init();
215    
216    // ie8-9 workaround for image carousels
217    // @TODO: find the reason...
218    if (jQuery("body").hasClass("ie8") || jQuery("body").hasClass("ie9")) {
219        jQuery("#main").on("click", ".imgcarousel .carousel-control", function(event) {
220            event.stopPropagation();
221            jQuery(this).closest(".imgcarousel").carousel(jQuery(this).data("slide"));
222            return false;
223        });
224        jQuery("#main").on("click", ".pricecarousel .carousel-control", function(event) {
225            event.stopPropagation();
226            jQuery(this).closest(".pricecarousel").carousel(jQuery(this).data("slide"));
227            return false;
228        });
229    }
230	
231    // event for all price carousels
232    jQuery(".pricecarousel").on("slide.bs.carousel", function(event) {
233        
234        // indexes
235        var slideFrom = jQuery(this).find('.active').index();
236        var slideTo = jQuery(event.relatedTarget).index();
237
238        // detail site functionality
239        if (siteType == "pricelist") {
240            
241            // shortcut
242            var $Wrapper = jQuery(".ncm_prices_list_wrapper");
243            
244            // loading
245            $Wrapper.find(".selection").addClass("loading");
246
247            // update index
248            $Wrapper.attr("data-selected", slideTo);
249            
250            // start search
251            pricelistRoomSearch.search();
252        }
253    });
254
255    // event for all price carousels
256    jQuery(".pricecarousel").on("slid.bs.carousel", function(event) {
257
258        // details functionality
259        if (siteType == "pricelist") {
260            // shortcut
261            var $Wrapper = jQuery(".ncm_prices_list_wrapper");
262
263            // remove loading class
264            $Wrapper.removeClass("loading");
265        }
266    
267    });
268    
269    // swipe
270	jQuery(".pricecarousel, .imgcarousel").swipe({
271	    //onSwipe:function(direction, data){
272	    swipe:function(event, direction, distance, duration, fingerCount) {
273			switch (direction) {
274				case "left":
275				jQuery(this).carousel("next");
276				break;
277				case "right":
278				jQuery(this).carousel("prev");
279				break;
280				//case "up":
281				//case "down":
282				//case "none":
283				//  window.scrollBy(0,data.distY * -1);
284				//  break;
285			}
286	    },
287        click:function(event) {
288            if (jQuery(this).hasClass("imgcarousel")) {
289                jQuery(this).find('.active a').trigger("click");
290            }
291        },
292	    //threshold:50,
293	    allowPageScroll:"vertical"
294	});
295    
296    
297});

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.