1/*********************************************************************************/ 2/*************************** Responsive Settings ****************************/ 3 4 //~~~~~~~~~~~~~~~~~~~~~~> 990 +++ 5 // number of elements comes from back-office 6 7 //~~~~~~~~~~~~~~~~~~~~~~> 769 ==> 990 8 var nItems_GD_medium = 3 ; //---> Gallery Display (articles) 9 var nItems_GV_medium = 3 ; //---> Gallery View 10 var nItems_MM_Big = 4 ; //---> more movies in Movie Page 11 var nItems_MM_medium = 3 ; //---> more movies in Movie Page 12 13 //~~~~~~~~~~~~~~~~~~~~~~> 481 ==> 768 14 // number of elements is fixed to 2 15 16 //~~~~~~~~~~~~~~~~~~~~~~> --- 480 17 // number of elements is fixed to 1 18 19 20 var footer_empty_last_item = false; //---> set true if use the last item space to put something else from bottom area 21 22 23/*********************************************************************************/ 24/*********************************************************************************/ 25 26$(document).ready(function() { 27 28// -------------------------------> Keep this code at top 29 30 var window_width = viewport().width; // the correct window sizes with scroller (this fits css @media screen and ..sizes ) 31 //alert($(window).width()); 32 //alert(window_width); 33 34 var site_align = ''; 35 var lang = $('html').attr('lang'); 36 //alert(lang); 37 if (lang == 'he' || lang == 'ar') { 38 $('body').addClass('RTL'); 39 site_align = 'right'; 40 } else { 41 $('body').addClass('LTR'); 42 site_align = 'left' 43 }; 44 45 // -------------------------------> Control sizes of Images from Editor 46 $('#ctlBody IMG, div.description IMG, div.FreeBoxBody IMG, div.Article-TabsBox IMG').each(function() { 47 $(this).wrap('<div class="editor-div-img"></div>'); 48 $(this).attr('height','auto'); 49 $(this).css('height','auto'); 50 var img_align = $(this).attr('align'); 51 if (img_align == 'right') { 52 $(this).parent('div.editor-div-img').css({'float':'right', 'margin':'10px 0px 10px 10px'}); 53 } else if (img_align == 'left') { 54 $(this).parent('div.editor-div-img').css({'float':'left', 'margin':'10px 10px 10px 0px'}); 55 } else if (img_align == 'middle') { 56 $(this).parent('div.editor-div-img').css('margin','10px auto 10px auto'); 57 } 58 $('TABLE div.editor-div-img').css('margin','auto'); // cancel spacing in tables 59 }); 60 61 // -------------------------------> Control sizes of Video & Iframes from Editor 62 $('#ctlBody IFRAME, div.description IFRAME, div.FreeBoxBody IFRAME').each(function() { 63 var iframe_src = $(this).attr('src'); 64 //alert(iframe_src.toLowerCase().indexOf('youtube') != -1); 65 if (iframe_src.toLowerCase().indexOf('youtube') != -1) { 66 $(this).wrap('<div class="editor-div-yt-video"></div>'); 67 $('div.editor-div-yt-video').wrap('<div class="editor-div-yt-video-container"></div>'); 68 } else { 69 $(this).wrap('<div class="editor-div-iframe"></div>'); 70 } 71 }); 72 73 $('#ctlBody OBJECT, div.description OBJECT, div.FreeBoxBody OBJECT').each(function() { 74 $(this).wrap('<div class="editor-div-video"></div>'); 75 }); 76 $('#ctlBody embed, div.description embed, div.FreeBoxBody embed').each(function() { 77 $(this).wrap('<div class="editor-div-video"></div>'); 78 }); 79// -------------------------------> End keep at top 80 81 // -------------------------------> Adding "hover.css" classes for html5 animations based on this - http://ianlunn.github.io/Hover/ 82 // logo 83 $('A.logo-normal, A.logo-small, A.logo2').addClass('hvr-shrink'); 84 85 // bottom bar 86 $('#bottomBar UL.NavigationBarSimple LI A').addClass('hvr-wobble-bottom'); 87 88 // buttons 89 $('INPUT[type="submit"], INPUT[type="button"], div.output A.ReadMore').addClass('hvr-grow-shadow'); 90 91 // articles gallery view 92 $('div.CategoryItemContainer').addClass('hvr-grow-shadow'); 93 94 95 96 // -------------------------------> Add special class for select in explorer 97 $('select').each(function(){ 98 if (BrowserType() == 'ie') { 99 $(this).addClass('selectIE9'); 100 } 101 }); 102 103 104 // -------------------------------> Simple Top nav Box & Collaps button 105 $('.simple-open').click(function(e) { 106 e.preventDefault(); 107 if (lang == 'he' || lang == 'ar') { 108 if ($(this).is('.simple-open')) { 109 $('.simple-box').animate({right : '0px'},{duration:500}); 110 $(this).animate({right : '200px'},{duration:500}); 111 $(this).toggleClass('simple-open simple-close'); 112 } else { 113 $('.simple-box').animate({right : '-210px'},{duration:500}); 114 $(this).animate({right : '0px'},{duration:500}); 115 $(this).toggleClass('simple-close simple-open'); 116 }; 117 } else { 118 if ($(this).is('.simple-open')) { 119 $('.simple-box').animate({left : '0px'},{duration:500}); 120 $(this).animate({left : '200px'},{duration:500}); 121 $(this).toggleClass('simple-open simple-close'); 122 } else { 123 $('.simple-box').animate({left : '-210px'},{duration:500}); 124 $(this).animate({left : '0px'},{duration:500}); 125 $(this).toggleClass('simple-close simple-open'); 126 }; 127 } 128 }); 129 130 131 // -------------------------------> title to images 132 $('#main_image IMG').each(function() { 133 var img_alt = $(this).attr('alt'); 134 //alert(img_alt == "undefined" || typeof img_alt == 'undefined'); 135 $(this).attr('title',img_alt); 136 if (img_alt == "undefined" || typeof img_alt == 'undefined') { 137 if (lang == 'he' || lang == 'ar') { 138 img_alt = "××× ×ש ת××× ×" 139 } else { 140 img_alt = "a photo" 141 }; 142 $(this).attr('alt',img_alt); 143 } 144 }); 145 146 147 // -------------------------------> open editor "onClick" images in lightbox 148 $('#ctlBody IMG, div.description IMG, div.FreeBoxBody IMG, div.Article-TabsBox IMG').each(function() { 149 var the_img_src = $(this).attr('src') 150 if (the_img_src.toLowerCase().indexOf("_uploads") != -1) { 151 var attrOK = $(this).attr('onclick'); 152 if (attrOK != "undefined" && !typeof attrOK === 'undefined' && attrOK != "") { 153 var sFile = the_img_src;
154 var sFileTemp = sFile.toLowerCase().replace("_cut/",""); 155 var nPos = sFileTemp.lastIndexOf("/"); 156 var sFileName = sFileTemp.substr(nPos+1,sFile.length-nPos); 157 if (sFileName.length > 13) { 158 sFileName = sFileName.substr(13,sFileName.length-13); 159 var sFilePath = sFile.substr(0,nPos+1); 160 sFile = sFilePath + sFileName; 161 } 162 //alert('*********** ' + sFile + ' ***********'); 163 $(this).wrap('<a data-lightbox="gallery-set" href="' + sFile + '"></a>'); 164 $(this).attr('onclick',''); 165 } 166 } 167 }); 168 169 170 // -------------------------------> Login 171 $('A.LoginOpen').click(function(){ 172 $('div.LoginBox').slideToggle(500); 173 $('#LoginJQ').toggleClass('icon-active'); 174 }); 175 176 // -------------------------------> Contact us 177 $('A.ContactOpen').click(function(){ 178 $('div.ContactBox').slideToggle(500); 179 $('#ContactJQ').toggleClass('icon-active'); 180 }); 181 182 // ------------------------------- Search (under 480) 183 $('A.SearchOpen').click(function(){ 184 $('#SearchJQ div.SearchContainer').slideToggle(500); 185 $('#SearchJQ').toggleClass('icon-active'); 186 }); 187 188 189 // -------------------------------> Side Bar open/close 190 if (window_width > 768) { 191 $('div.NavigationTitle').addClass('open'); 192 } else { 193 $('div.NavigationTitle').addClass('closed'); 194 }; 195 $('div.NavigationTitle').click(function(){ 196 $('UL.VerticalBarContainer').slideToggle(500); 197 //console.log($(this).hasClass('open')); 198 if ($(this).hasClass('open')) { 199 $('div.NavigationTitle').removeClass('open').addClass('closed'); 200 } else { 201 $('div.NavigationTitle').removeClass('closed').addClass('open'); 202 }; 203 }); 204 205 206 // -------------------------------> HomePage Awesome Bar on mouse over (Awesome) 207 $('#workshop UL.NavigationBarAwesome LI').each(function() { 208 $(this).find('img').prependTo($(this).find('A.NavigationBarAwesome')); 209 }); 210 211 212 // -------------------------------> Go Top button 213 $('#go-top').click(function(){ 214 $("html, body").animate({ scrollTop: "0" },"slow"); 215 }); 216 217 218 // -------------------------------> Daronet Logo 219 //var daronet_text = $('TD.daronet_link A.Daronet').text(); sample for imargency (old if) - if (daronet_text.indexOf('Web') != -1) { .... 220 //alert(daronet_text); 221 if (lang == 'he') { 222 $('TD.daronet_link A.Daronet').html('×× ××ת ×תר××'); 223 $('TD.daronet_link A.Daronet').attr('×× ××ת ×תר××'); 224 $('TD.daronet_img IMG').attr('alt','×ר×× × ×× ××ת ×תר××'); 225 $('TD.daronet_img IMG').attr('title','×ר×× × ×× ××ת ×תר××'); 226 } else { 227 $('TD.daronet_link A.Daronet').html('Web Building'); 228 $('TD.daronet_link A.Daronet').attr('title','Web Building'); 229 $('TD.daronet_img IMG').attr('alt','Daronet Web Building'); 230 $('TD.daronet_img IMG').attr('title','Daronet Web Building'); 231 $('TD.daronet_img A').attr('href','http://www.daro-net.co.il/english/'); 232 $('TD.daronet_link A.Daronet').attr('href','http://www.daro-net.co.il/english/'); 233 }; 234 235 236 // -------------------------------> List Articles - remove last article bottom seperator 237 $('DIV.body').find('DIV.ArticlesListContainer').last().find('DIV.ArticlesListSeperator').css('display','none'); 238 239 240 // -------------------------------> fix editor HTML mode bug space before <sub>/<sup> 241 $('#ctlBody, div.description, div.FreeBoxBody').each(function() { 242 var this_html = $(this).html(); 243 if (this_html.indexOf('<sub>') != -1 || this_html.indexOf('<sup>') != -1) { 244 this_html = this_html.replaceAll(' <sub>','<sub>',true); 245 this_html = this_html.replaceAll(' </sub>','</sub>',true); 246 this_html = this_html.replaceAll(' <sub>','<sub>',true); 247 this_html = this_html.replaceAll(' </sub>','</sub>',true); 248 this_html = this_html.replaceAll(' <sup>','<sup>',true); 249 this_html = this_html.replaceAll(' </sup>','</sup>',true); 250 this_html = this_html.replaceAll(' <sup>','<sup>',true); 251 this_html = this_html.replaceAll(' </sup>','</sup>',true); 252 $(this).html(this_html); 253 } 254 }); 255 256 257 // -------------------------------> place form in header in top-line 258 if (window_width > 1040) { 259 $('#form-source').appendTo($('#side-tab-form'));
260 } else { 261 $('#form-source').appendTo($('#form-code')); 262 }; 263 $('#form-source').css('display','block'); 264 265 // -------> click comtact us 266 $('#side-contact-tab A').click(function(e){ 267 e.preventDefault(); 268 if ($(this).is('.contact-tab-open')) { 269 $('#side-contact-tab').animate({left : '0px' , bottom : '0px'},{duration:500}).css('z-index','9999'); 270 $(this).toggleClass('contact-tab-open contact-tab-close'); 271 $(this).find('i').toggleClass('fa-envelope-o fa-times'); 272 } else { 273 $('#side-contact-tab').animate({left : '-245px' , bottom : '-360px'},{duration:500}).css('z-index','1'); 274 $(this).toggleClass('contact-tab-close contact-tab-open'); 275 $(this).find('i').toggleClass('fa-times fa-envelope-o'); 276 }; 277 }); 278 279}); 280// <== end $(document).ready 281 282 283 284 285$(window).load(function() { 286 // -------------------------------> Change original paging html code 287 paging_html = $('ol.dbsPages').html(); 288 if (typeof paging_html != "undefined" && paging_html != "") { 289 cleaned_paging_html = paging_html.replace(/ /g, ''); // <== replace All places that ' ' appear to '' 290 png_paging_html = cleaned_paging_html.replace(/gif/g, 'png'); // <== replace All places that 'gif' appear to 'png' 291 $('ol.dbsPages').html(png_paging_html); 292 //$('ol.dbsPages').parent('div').addClass('dbsPages-container'); 293 } 294 295 // -------------------------------> show all 296 $('.main-container').css('opacity','1'); 297 $('.loader-container').remove(); 298 299 300 // -------------------------------> equal height Hp "banners" (simple nav) 301 if (window_width > 768) { 302 equalHeight('.subjects-line ul li A'); 303 } else { 304 $('.subjects-line ul li A').css('height','auto'); 305 } 306 307 // -------------------------------> equal height Hp freeboxes 308 if (window_width > 768) { 309 equalHeight('#FreeBox_Section4 div.FreeBoxContainer, #FreeBox_Section5 div.FreeBoxContainer, #FreeBox_Section6 div.FreeBoxContainer'); 310 } else if (window_width > 640 && window_width < 769) { 311 equalHeight('#FreeBox_Section4 div.FreeBoxContainer, #FreeBox_Section5 div.FreeBoxContainer'); 312 $('#FreeBox_Section6 div.FreeBoxContainer').css('height','auto'); 313 } else { 314 $('#FreeBox_Section4 div.FreeBoxContainer').css('height','auto'); 315 $('#FreeBox_Section5 div.FreeBoxContainer').css('height','auto'); 316 $('#FreeBox_Section6 div.FreeBoxContainer').css('height','auto'); 317 } 318}); 319 320 321 322 323$(window).resize(function() { 324 // -------------------------------> Side Bar 325 var window_width = viewport().width; // the correct window sizes with scroller (this fits css @media screen and ..sizes ) 326 //alert(window_width); 327 if (window_width > 768) { 328 $('div.NavigationTitle').addClass('open').removeClass('closed'); 329 $('UL.VerticalBarContainer').css('display','block'); 330 /*} else { // cancelled because samsong bug touch up/down trigger resize 331 alert('resize'); 332 $('div.NavigationTitle').addClass('closed').removeClass('open'); 333 $('UL.VerticalBarContainer').css('display','none');*/ 334 }; 335 336 // -------------------------------> place form in header in top-line 337 waitForFinalEvent(function(){ 338 if (window_width > 1040) { 339 $('#form-source').appendTo($('#side-tab-form')); 340 } else { 341 $('#form-source').appendTo($('#form-code')); 342 }; 343 }, 400, "move_form"); 344 345 // -------------------------------> equal height Hp "banners" (simple nav) 346 if (window_width > 768) { 347 equalHeight('.subjects-line ul li A'); 348 } else { 349 $('.subjects-line ul li A').css('height','auto'); 350 } 351 352 353 // -------------------------------> equal height Hp freeboxes 354 if (window_width > 768) { 355 equalHeight('#FreeBox_Section4 div.FreeBoxContainer, #FreeBox_Section5 div.FreeBoxContainer, #FreeBox_Section6 div.FreeBoxContainer'); 356 } else if (window_width > 640 && window_width < 769) { 357 equalHeight('#FreeBox_Section4 div.FreeBoxContainer, #FreeBox_Section5 div.FreeBoxContainer'); 358 $('#FreeBox_Section6 div.FreeBoxContainer').css('height','auto'); 359 } else { 360 $('#FreeBox_Section4 div.FreeBoxContainer').css('height','auto'); 361 $('#FreeBox_Section5 div.FreeBoxContainer').css('height','auto'); 362 $('#FreeBox_Section6 div.FreeBoxContainer').css('height','auto'); 363 } 364}); 365 366 367 368$(window).scroll(function(){ 369var window_width = viewport().width; // the correct window sizes with scroller (this fits css @media screen and ..sizes ) 370 371// -------------------------------> Top Bar when scroll 372 var header_height = 100; //$('.header').height(); // if top-bar-line is position absolute - use top_bar_pos 373 if ($(window).scrollTop() > header_height) { 374 // when scroll down 375 if (window_width > 990) { 376 $('.main-container').addClass('stick'); 377 $('.top-bar-line').addClass('stick'); 378 } 379 $('a.logo-small').show(200); 380 $('a.logo-normal').hide(200); 381 $('a.logo2').hide(200); 382 } else { 383 // when scroll up 384 if (window_width > 990) { 385 $('.main-container').removeClass('stick'); 386 $('.top-bar-line').removeClass('stick'); 387 } 388 $('a.logo-small').hide(200); 389 $('a.logo-normal').show(200); 390 $('a.logo2').show(200); 391 } 392}); 393 394 395 396 397// ------------------------------- Login 398function LoginClose(){ 399 $('A.LoginOpen').trigger('click'); 400} 401 402// ------------------------------- Contact us 403function ContactClose(){ 404 $('A.ContactOpen').trigger('click'); 405} 406 407// ------------------------------- Shopping Cart 408function ShoppingCartOpen(){ 409 $('div.ShoppingCartBox').slideToggle(500); 410 $('#ShoppingCartJQ').toggleClass('icon-active'); 411 return false; 412} 413 414function ShoppingCartClose(){ 415 ShoppingCartOpen(); 416} 417 418// ------------------------------- Search 419function SearchClose(){ 420 $('A.SearchOpen').trigger('click'); 421} 422 423 424// -------------------------------> Equal Height of elements (per row) 425// !!!! use it with $(window).load(function(){ so it works after images are loaded 426equalHeight = function(container){ 427 //console.log('******************** equalHeight'); 428 //console.log(container); 429 var currentTallest = 0, 430 currentRowStart = 0, 431 rowdivs = new Array(), 432 $el, 433 topPosition = 0; 434 $(container).each(function() { 435 $el = $(this); 436 $($el).height('auto') 437 topPostion = $el.position().top; 438 //console.log('topPostion = ' + topPostion); 439 if (currentRowStart != topPostion) { 440 for (currentdiv = 0 ; currentdiv < rowdivs.length ; currentdiv++) { 441 rowdivs[currentdiv].height(currentTallest); 442 } 443 rowdivs.length = 0; // empty the array 444 currentRowStart = topPostion; 445 currentTallest = $el.height(); 446 rowdivs.push($el); 447 //console.log('rowdivs.length = ' + rowdivs.length); 448 } else { 449 rowdivs.push($el); 450 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 451 } 452 for (currentdiv = 0 ; currentdiv < rowdivs.length ; currentdiv++) { 453 rowdivs[currentdiv].height(currentTallest); 454 } 455 }); 456} 457 458 459//---------------------------------> Get the correct window sizes with scroller (this fits css @media screen and ..sizes ) 460function viewport() { 461 var e = window, a = 'inner'; 462 if (!('innerWidth' in window )) { 463 a = 'client'; 464 e = document.documentElement || document.body; 465 } 466 return { width : e[ a+'Width' ] , height : e[ a+'Height' ]}; 467} 468 469 470//---------------------------------> function for Browser Type 471function BrowserType() { 472 var sBrowserType = ""; 473 var sAppName = window.navigator.userAgent.toLowerCase(); 474 //alert(sAppName); 475 if (sAppName.indexOf("firefox") != -1) { 476 sBrowserType = "firefox"; 477 } else if (sAppName.indexOf("msie") != -1) { 478 sBrowserType = "ie9max"; // 10,11 don't have "msie" 479 } else if (sAppName.indexOf("trident") != -1) { 480 sBrowserType = "ie10upper"; 481 } else if (sAppName.indexOf("chrome") != -1) { 482 sBrowserType = "chrome"; 483 } else if (navigator.userAgent.indexOf('safari') != -1 && navigator.userAgent.indexOf('chrome') == -1) { 484 sBrowserType = "safari"; 485 } else if (sAppName.indexOf("opera") != -1) { 486 sBrowserType = "opera"; 487 } 488 //alert(sBrowserType); 489 return sBrowserType; 490} 491 492 493 494//---------------------------------> function for after continues event like scroll , resize ... 495var waitForFinalEvent = (function() { 496 var timers = {}; 497 return function (callback, ms, uniqueId) { 498 if (!uniqueId) { 499 uniqueId = "Don't call this twice without a uniqueId"; 500 } 501 if (timers[uniqueId]) { 502 clearTimeout (timers[uniqueId]); 503 } 504 timers[uniqueId] = setTimeout(callback, ms); 505 }; 506})(); 507 508 509 510//---------------------------------> function for replace all 511String.prototype.replaceAll = function(search, replace, ignoreCase) { 512 if (ignoreCase) { 513 var result = []; 514 var _string = this.toLowerCase(); 515 var _search = search.toLowerCase(); 516 var start = 0, match, length = _search.length; 517 while ((match = _string.indexOf(_search, start)) >= 0) { 518 result.push(this.slice(start, match)); 519 start = match + length; 520 } 521 result.push(this.slice(start)); 522 } else { 523 result = this.split(search); 524 } 525 return result.join(replace); 526} 527
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.