PageSourceSearch

https://www.bayut.bh/mybayut/wp-content/plugins/alia-core/inc/alia-core.js?ver=1.11

js bayut.bh collected 2026-10-02 00:15:28 UTC 12,912 bytes, 327 lines download raw bytes

1function aliaCoreReadyFn(jQuery) {
2
3    "use strict";
4
5    /* --------
6    start open stories modal
7    ------------------------------------------- */
8    jQuery(".story_hotlink").on("click", function(e) {
9
10      storyModalResizeToFit();
11
12      var postid = jQuery(this).attr('data-postid');
13      var authorid = jQuery(this).attr('data-author');
14
15      jQuery('#ajax_modal_story').html('<div class="story_modal_loader"><div class="alia_spinner"><div class="alia-double-bounce1"></div><div class="alia-double-bounce2"></div></div></div>');
16      jQuery('#ajax_modal_story').modal();
17
18      jQuery.ajax({
19        url: alia_core_vars.ajax_load_story,
20        type:'POST',
21        data: "postid="+ postid + "&authorid="+ authorid,
22        success: function(html) {
23          jQuery("#ajax_modal_story").html(html).prepend('<div class="story_modal_overlay_helper"></div><div class="story_rotate_loader story_modal_loader"><div class="alia_spinner"><div class="alia-double-bounce1"></div><div class="alia-double-bounce2"></div></div></div>');
24        }
25      });
26      e.preventDefault();
27    });
28
29    /* call storyModalResizeToFit function on dom ready and resize */
30    htmlCheckWindowHeight();
31    jQuery(window).on('resize', function() {
32      htmlCheckWindowHeight();
33
34      storyModalResizeToFit();
35      });
36
37    /* --------
38    end open stories modal
39    ------------------------------------------- */
40    
41    /* --------
42    start stories rotate
43    ------------------------------------------- */
44    jQuery(".story_modal_window_next").on('click', function(e) {
45      storyRotateNext(e);
46    });
47
48    jQuery(".story_modal_window_prev, .story_modal_window_current").on('click', function(e) {
49      storyRotatePrev(e);
50    });
51
52    var touchStartX;
53    var touchStartY;
54
55    jQuery(".ajax_modal .story_modal_window").on('touchstart', function (e){
56      touchStartX = e.originalEvent.touches[0].clientX;
57      touchStartY = e.originalEvent.touches[0].clientY;
58    });
59
60    jQuery(".ajax_modal .story_modal_window").on('touchmove', function (e){
61      var touchEndX = e.originalEvent.changedTouches[0].clientX;
62      var touchEndY = e.originalEvent.changedTouches[0].clientY;
63      var touchDif;
64      var blurAmount;
65
66      touchDif = touchEndX - touchStartX;
67      if (touchDif < 0) {
68        touchDif = touchDif * -1;
69      }
70
71      if ( blurAmount < 2 ) {
72        blurAmount = touchDif * 2 / 60;
73      }else{
74        blurAmount = 2;
75      }
76      
77      blurAmount = 'blur('+parseInt(blurAmount)+'px)';
78      jQuery('.story_modal_window_current').css({'filter'         : blurAmount,
79                                       '-webkit-filter' : blurAmount,
80                                       '-moz-filter'    : blurAmount,
81                                       '-o-filter'      : blurAmount,
82                                       '-ms-filter'     : blurAmount});
83
84    });
85
86
87    jQuery(".ajax_modal .story_modal_window, .ajax_modal .story_modal_window .story_black_overlay").on('touchend', function (e){
88
89      
90
91      if (e.target !== this){
92            return;
93      }
94       var touchEndX = e.originalEvent.changedTouches[0].clientX;
95       var touchEndY = e.originalEvent.changedTouches[0].clientY;
96       
97       if (jQuery('body.rtl').length) {
98            if(touchStartX > touchEndX+60 && ( touchStartY < touchEndY+130 && touchStartY > touchEndY-130) ){
99              storyRotateNext(e); 
100            }else if(
101                 ( touchStartX < touchEndX-60 && ( touchStartY < touchEndY+130 && touchStartY > touchEndY-130) ) ||
102                 ( touchStartX < touchEndX+30 && touchStartX > touchEndX-30 && touchStartY < touchEndY+30 && touchStartY > touchEndY-30 )
103            ){
104              storyRotatePrev(e);
105
106            }else{
107              jQuery('.story_modal_window').css({'filter'         : "initial",
108                                               '-webkit-filter' : "initial",
109                                               '-moz-filter'    : "initial",
110                                               '-o-filter'      : "initial",
111                                               '-ms-filter'     : "initial"});
112            }
113       }else{
114            if(touchStartX < touchEndX-60 && ( touchStartY > touchEndY-130 && touchStartY < touchEndY+130) ){
115              storyRotateNext(e); 
116            }else if(
117                 ( touchStartX > touchEndX+60 && ( touchStartY > touchEndY-130 && touchStartY < touchEndY+130) ) ||
118                 ( touchStartX > touchEndX-30 && touchStartX < touchEndX+30 && touchStartY > touchEndY-30 && touchStartY < touchEndY+30 )
119            ){
120              storyRotatePrev(e);
121
122            }else{
123              jQuery('.story_modal_window').css({'filter'         : "initial",
124                                               '-webkit-filter' : "initial",
125                                               '-moz-filter'    : "initial",
126                                               '-o-filter'      : "initial",
127                                               '-ms-filter'     : "initial"});
128            }
129       }
130        
131    });
132
133    jQuery("#ajax_modal_story.disable_rotate .story_modal_overlay_helper").on('touchmove touchstart touchcancel click touchend', function(e){
134      e.preventDefault();
135    });
136
137    jQuery("#ajax_modal_story.enable_rotate .story_modal_overlay_helper").on('touchend click', function(e){
138      jQuery.modal.close();
139    });
140
141    jQuery('.ajax_modal').on('touchmove', function(e) {
142      e.preventDefault();
143    });
144
145    jQuery(document).keydown(function(e) {
146        switch(e.which) {
147            case 37: // left
148              if (jQuery('body.rtl').length) {
149                storyRotatePrev(e);
150              }else{
151                storyRotateNext(e);
152              }
153            break;
154
155            case 39: // right
156              if (jQuery('body.rtl').length) {
157                storyRotateNext(e);
158              }else{
159                storyRotatePrev(e);
160              }
161            break;
162
163            case 13: // escape
164              if (jQuery('.story_modal_window_current').length) {
165                  jQuery.modal.close();
166                  e.preventDefault();
167              }
168            break;
169
170            default: return; // exit this handler for other keys
171        }
172        
173    });
174
175    /* --------
176    end stories rotate
177    ------------------------------------------- */
178}
179
180jQuery( document ).ready( aliaCoreReadyFn );
181
182/* --------
183start story modal resize function
184------------------------------------------- */
185
186function storyRotateNext(e) {
187  if (jQuery('.story_modal_window_next').length && !jQuery("#ajax_modal_story.disable_rotate").length) {
188    jQuery('#ajax_modal_story').addClass('disable_rotate').removeClass('enable_rotate');
189
190    jQuery('.story_modal_window_before_prev').remove();
191
192    jQuery('.story_modal_window_prev').addClass('story_modal_window_before_prev').removeClass('story_modal_window_prev').addClass('story_modal_window_preload');
193
194    jQuery('.story_modal_window_current').addClass('story_modal_window_prev').addClass('story_modal_window_nav').removeClass('story_modal_window_current');
195
196    jQuery('.story_modal_window_next').addClass('story_modal_window_current').removeClass('story_modal_window_next').removeClass('story_modal_window_nav');
197
198
199    if (jQuery('.story_modal_window_after_next').length) {
200
201      var postid = jQuery('.story_modal_window_after_next').attr('data-postid');
202      var authorid = jQuery('.story_modal_window_after_next').attr('data-author');
203      var rotateDirection = "next";
204
205      jQuery('.story_modal_window_after_next').addClass('story_modal_window_next').removeClass('story_modal_window_after_next').removeClass('story_modal_window_preload');
206
207      
208
209      jQuery.ajax({
210        url: alia_core_vars.ajax_rotate_story,
211        type:'POST',
212        data: "postid="+ postid + "&authorid="+ authorid + "&rotateDirection="+ rotateDirection,
213        success: function(html) {
214          jQuery("#ajax_modal_story").append(html);
215          jQuery('#ajax_modal_story').removeClass('disable_rotate').addClass('enable_rotate');
216          jQuery('.story_modal_window').css({'filter'         : "initial",
217                                           '-webkit-filter' : "initial",
218                                           '-moz-filter'    : "initial",
219                                           '-o-filter'      : "initial",
220                                           '-ms-filter'     : "initial"});
221        }
222      });
223      
224    }else{
225      jQuery('#ajax_modal_story').removeClass('disable_rotate').addClass('enable_rotate');
226    }
227
228    e.preventDefault();
229
230  }else{
231    jQuery('.story_modal_window').css({'filter'         : "initial",
232                                             '-webkit-filter' : "initial",
233                                             '-moz-filter'    : "initial",
234                                             '-o-filter'      : "initial",
235                                             '-ms-filter'     : "initial"});
236  }
237}
238
239function storyRotatePrev(e) {
240    
241
242    if ( jQuery('.story_modal_window_prev').length && !jQuery("#ajax_modal_story.disable_rotate").length ) {
243
244      jQuery('#ajax_modal_story').addClass('disable_rotate').removeClass('enable_rotate');
245
246      jQuery('.story_modal_window_after_next').remove();
247
248      jQuery('.story_modal_window_next').addClass('story_modal_window_after_next').removeClass('story_modal_window_next').addClass('story_modal_window_preload');
249
250      jQuery('.story_modal_window_current').addClass('story_modal_window_next').addClass('story_modal_window_nav').removeClass('story_modal_window_current');
251
252      jQuery('.story_modal_window_prev').addClass('story_modal_window_current').removeClass('story_modal_window_prev').removeClass('story_modal_window_nav');
253      
254      if (jQuery('.story_modal_window_before_prev').length) {
255        var postid = jQuery('.story_modal_window_before_prev').attr('data-postid');
256        var authorid = jQuery('.story_modal_window_before_prev').attr('data-author');
257        var rotateDirection = "prev";
258        
259        jQuery('.story_modal_window_before_prev').addClass('story_modal_window_prev').removeClass('story_modal_window_before_prev').removeClass('story_modal_window_preload');
260
261        
262
263        jQuery.ajax({
264          url: alia_core_vars.ajax_rotate_story,
265          type:'POST',
266          data: "postid="+ postid + "&authorid="+ authorid + "&rotateDirection="+ rotateDirection,
267          success: function(html) {
268            jQuery("#ajax_modal_story").append(html);
269            jQuery('#ajax_modal_story').removeClass('disable_rotate').addClass('enable_rotate');
270
271            jQuery('.story_modal_window').css({'filter'         : "initial",
272                                             '-webkit-filter' : "initial",
273                                             '-moz-filter'    : "initial",
274                                             '-o-filter'      : "initial",
275                                             '-ms-filter'     : "initial"});
276
277          }
278        });
279        
280      }else{
281        jQuery('#ajax_modal_story').removeClass('disable_rotate').addClass('enable_rotate');
282      }
283
284      e.preventDefault();
285
286    }else{
287      jQuery('.story_modal_window').css({'filter'         : "initial",
288                                             '-webkit-filter' : "initial",
289                                             '-moz-filter'    : "initial",
290                                             '-o-filter'      : "initial",
291                                             '-ms-filter'     : "initial"});
292    }
293}
294
295
296function storyModalResizeToFit() {
297    var windowHeight = jQuery(window).height();
298    var windowWidth = jQuery(window).width();
299    var newWindowHeight;
300    var newWindowWidth;
301
302    if ( (windowHeight < 800 || windowWidth < 600 ) && (windowHeight/windowWidth) <= (800/600) ) {
303      newWindowHeight = windowHeight-116;
304      newWindowWidth = newWindowHeight * 600 / 800;
305      jQuery('#ajax_modal_story').css({'height' : newWindowHeight , 'width' : newWindowWidth}).removeClass("small_screens");
306    }else if ((windowHeight < 800 || windowWidth < 600 ) && (windowHeight/windowWidth) >= (800/600)) {
307      newWindowWidth = windowWidth-40;
308      newWindowHeight = newWindowWidth * 800 / 600;
309      jQuery('#ajax_modal_story').css({'height' : newWindowHeight , 'width' : newWindowWidth}).addClass("small_screens");
310    }else {
311      newWindowWidth = 600;
312      newWindowHeight = 800;
313      jQuery('#ajax_modal_story').css({'height' : newWindowHeight , 'width' : newWindowWidth}).addClass("small_screens");
314    }
315}
316
317function htmlCheckWindowHeight() {
318  var windowHeight = jQuery(window).height();
319  if ( windowHeight < 450 ) {
320    jQuery('html').addClass('small_screen_height');
321  }else{
322    jQuery('html').removeClass('small_screen_height');
323  }
324}
325/* --------
326end story modal resize function
327------------------------------------------- */

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.