1/** 2 * @package YJSG Framework 3 * @copyright Copyright(C) since 2007 Youjoomla.com. All Rights Reserved. 4 * @author YouJoomla 5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only 6 * @websites http://www.youjoomla.com | http://www.yjsimplegrid.com 7 */ 8; 9(function($, window, document, undefined) { 10 11 "use strict"; 12 13 var pluginName = "YjsgRespond", 14 defaults = { 15 menuholder: "#mmenu_holder", 16 topmenuholder: "#topmenu_holder", 17 selectmenu: "#mmenu" 18 }; 19 20 function Plugin(element, options) { 21 this.element = element; 22 23 this.settings = $.extend({}, defaults, options); 24 this._defaults = defaults; 25 this._name = pluginName; 26 this.init(); 27 } 28 29 30 $.extend(Plugin.prototype, { 31 init: function() { 32 33 var self = this; 34 this.windowWidth = self.getWindowWidth(); 35 self.showMenu(); 36 self.menuFlip(); 37 38 }, 39 40 onResize: function() { 41 var self = this; 42 self.windowWidth = self.getWindowWidth(); 43 }, 44 45 getWindowWidth: function() { 46 47 var self = this; 48 var width = window.innerWidth 49 || document.documentElement.clientWidth 50 || document.body.clientWidth; 51 52 return width; 53 }, 54 55 showMenu: function() { 56 var self = this; 57 if ($(self.settings.menuholder).length > 0) { 58 var select_holder = $(self.settings.menuholder); 59 $(self.settings.topmenuholder).prepend(select_holder); 60 $(self.settings.selectmenu).on('change', function() { 61 window.location.href = $(this).val(); 62 }); 63 } 64 }, 65 66 menuFlip: function() { 67 var self = this; 68 self.windowWidth = self.getWindowWidth(); 69 $("ul.yjsgmenu li.haschild").hover(function() { 70 $(this).removeClass("flip"); 71 var findMargin = $('ul.yjsgmenu ul ul').first().css('margin-left'); 72 var dropWidth = $(this).find('div.ulholder').first().outerWidth(true) + parseInt(findMargin); // ul side push 10px 73 var ltrOffset = $(this).find('div.ulholder').first().offset().left + dropWidth; 74 var rtlOffset = self.windowWidth - $(this).find('div.ulholder').first().offset().left; 75 var offset = ltrOffset; 76 if ($("body").hasClass("yjsgrtl")) { 77 offset = rtlOffset; 78 } 79 if (offset >= self.windowWidth) { 80 $(this).addClass("flip"); 81 } 82 }, function() { 83 setTimeout(function() { 84 $(this).removeClass("flip"); 85 }, 300); 86 }); 87 } 88 }); 89 90 $.fn[pluginName] = function(options) { 91 return this.each(function() { 92 if (!$.data(this, 'plugin_' + pluginName)) { 93 $.data(this, 'plugin_' + pluginName, new Plugin(this, options)); 94 } else if (Plugin.prototype[options]) { 95 $.data(this, 'plugin_' + pluginName)[options](); 96 } 97 }); 98 } 99 100})(jQuery, window, document); 101 102 103(function($) { 104 $(document).on('ready', function() { 105 $(document).YjsgRespond(); 106 }); 107 108 $(window).on('resize', function() { 109 $(document).YjsgRespond('onResize'); 110 }); 111 112}(jQuery));
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.