1/** 2 *------------------------------------------------------------------------------ 3 * @package T3 Framework for Joomla! 4 *------------------------------------------------------------------------------ 5 * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github 8 * & Google group to become co-author) 9 * @Google group: https://groups.google.com/forum/#!forum/t3fw 10 * @Link: http://t3-framework.org 11 *------------------------------------------------------------------------------ 12 */ 13 14var jActions = {}; 15 16(function($){ 17 // Switch tool 18 jActions.switchClass = function ($btn) { 19 var action = $btn.data('action'), 20 target = $btn.data('target'), 21 value = $btn.data('value'), 22 key = $btn.data('key'), 23 $target = $btn.parents(target); 24 if (!$target.length) $target = $(target); 25 // get all class to remove 26 $target.find ('[data-action="' + action + '"]').not($btn).each(function(){ 27 $(this).removeClass ('active'); 28 $target.removeClass ($(this).data('value')); 29 }); 30 $target.addClass (value); 31 $btn.addClass ('active'); 32 // store into cookie 33 $.cookie (action + '-' + key, $btn.data('cookie') != 'no' ? value : '', {path: '/'}); 34 }; 35 jActions.switchClassInit = function ($btn) { 36 var action = $btn.data('action'), 37 target = $btn.data('target'), 38 defaultValue = $btn.data('value'), 39 key = $btn.data('key'), 40 cookieValue = $.cookie(action + '-' + key), 41 value = cookieValue ? cookieValue : defaultValue, 42 $target = $btn.parents(target); 43 if (!$target.length) $target = $(target); 44 // get all class to remove 45 $target.find ('[data-action="' + action + '"]').each(function(){ 46 var $this = $(this); 47 if ($this.data('value') == value) { 48 $target.addClass (value); 49 $this.addClass ('active'); 50 } else { 51 $this.removeClass ('active'); 52 $target.removeClass ($this.data('value')); 53 } 54 }); 55 // store into cookie 56 $.cookie (action + '-' + key, $btn.data('cookie') != 'no' ? value : '', {path: '/'}); 57 }; 58 59 60 // Switch tool 61 jActions.onOff = function ($btn) { 62 var action = $btn.data('action'), 63 target = $btn.data('target'), 64 cls = $btn.data('value'), 65 key = $btn.data('key'), 66 $target = $btn.parents(target), 67 value = ''; 68 if (!$target.length) $target = $(target); 69 value = $target.hasClass (cls) ? 'off' : 'on'; 70 // get all class to remove 71 if (value == 'off') { 72 $target.removeClass (cls); 73 $btn.removeClass('on').addClass ('off'); 74 } else { 75 $target.addClass (cls); 76 $btn.removeClass('off').addClass ('on'); 77 } 78 $.cookie (action + '-' + key, $btn.data('cookie') != 'no' ? value : '', {path: '/'}); 79 }; 80 jActions.onOffInit = function ($btn) { 81 var action = $btn.data('action'), 82 target = $btn.data('target'), 83 cls = $btn.data('value'), 84 defaultValue = $btn.data('default'), 85 key = $btn.data('key'), 86 cookieValue = $.cookie(action + '-' + key), 87 value = cookieValue ? cookieValue : defaultValue, 88 $target = $btn.parents(target); 89 if (!$target.length) $target = $(target); 90 // get all class to remove 91 if (value == 'on') { 92 $target.addClass (cls); 93 $btn.addClass ('on'); 94 } else { 95 $btn.addClass ('off'); 96 } 97 // store into cookie 98 $.cookie (action + '-' + key, $btn.data('cookie') != 'no' ? value : '', {path: '/'}); 99 }; 100 101 102 // next-prev actions tool 103 jActions.nextPrev = function ($btn) { 104 var action = $btn.data('action'), 105 target = $btn.data('target'), 106 prop = $btn.data('key'), 107 value = parseInt($btn.data('value')), 108 $target = $btn.parents(target), 109 values = $btn.parent().data(prop + 's').split(','), 110 curVal = $.cookie(action + '-' + prop), 111 curValIdx = $.inArray(curVal, values), 112 newValIdx = curValIdx + value; 113 if (!$target.length) $target = $(target); 114 if (!$btn.parent().data('loop') && (newValIdx < 0 || newValIdx >= values.length)) { 115 return ; 116 } 117 newValIdx = newValIdx < 0 ? values.length-1 : (newValIdx >= values.length ? 0 : newValIdx); 118 if (newValIdx != curValIdx) { 119 $target.removeClass(prop + '-' + curVal.replace(' ', '-').toLowerCase()).addClass(prop + '-' + values[newValIdx].replace(' ', '-').toLowerCase()); 120 if ($btn.data('cookie') != 'no') $.cookie(action + '-' + prop, values[newValIdx], {path: '/'}); 121 $btn.parent().find ('strong').removeClass().addClass (values[newValIdx]); 122 } 123 }; 124 jActions.nextPrevInit = function ($btn) { 125 var action = $btn.data('action'), 126 target = $btn.data('target'), 127 prop = $btn.data('key'), 128 defaultValue = $btn.data('default'), 129 $target = $btn.parents(target), 130 cookieValue = $.cookie(action + '-' + prop), 131 value = cookieValue ? cookieValue : defaultValue; 132 if (!$target.length) $target = $(target); 133 if (value) { 134 $target.addClass(prop + '-' + value.replace(' ', '-').toLowerCase()); 135 if ($btn.data('cookie') != 'no') $.cookie(action + '-' + prop, value, {path: '/'}); 136 $btn.parent().find ('strong').removeClass().addClass (value); 137 } 138 }; 139 140 jActions.loadModuleNextPage = function(link, modid, container, callback) { 141 var btn = $(link); 142 var curPage = parseInt(btn.attr('data-page')); 143 if(!curPage) curPage = 1; 144 145 btn.attr('disabled', 'disabled'); 146 btn.find('.fa-spin').show(); 147 148 var url = btn.data('link'); 149 url += (url.indexOf('?') == -1 ? '?' : '&') + 't3action=module&style=raw&mid='+modid+'&_module_page=' + (curPage + 1); 150 $.ajax({ 151 url: url, 152 method: 'POST', 153 success: function(data) { 154 $(link).find('.fa-spin').hide(); 155 if(data && data.replace(/^\s+|\s+$/gm,'') != '') { 156 $('#'+container).append(data); 157 btn.attr('data-page', curPage + 1); 158 if(btn.data('maxpage') && curPage + 1 < btn.data('maxpage')) { 159 btn.removeAttr('disabled'); 160 } else { 161 btn.html(Joomla.JText._('TPL_LOAD_MODULE_AJAX_DONE')); 162 } 163 if(typeof(callback) == 'function') { 164 callback(); 165 } 166 $(data).find("script").each(function(i) { 167 eval($(this).text()); 168 }); 169 } else { 170 btn.html(Joomla.JText._('TPL_LOAD_MODULE_AJAX_DONE')); 171 } 172 } 173 }); 174 return false;
175 }; 176})(jQuery); 177 178jQuery(document).ready(function($){ 179 $('[data-action]').each (function() { 180 // check & init default 181 var $this = $(this), 182 action = $this.data('action'); 183 if (jActions[action]) { 184 $this.on('click', function() { 185 jActions[action]($this); 186 return false; 187 }); 188 } 189 if ($this.data('default') != undefined && jActions[action + 'Init']) { 190 jActions[action + 'Init'] ($this); 191 } 192 }); 193 194 // prev / next article in reading-mode 195 $('.pagenav li a').on ('click', function() { 196 if ($('html').hasClass ('reading-mode')) { 197 $.cookie ('onOff-reading-mode', 'on', {path: '/'}); 198 } 199 }); 200 201 202 //////////////////////////////// 203 // equalheight for col 204 //////////////////////////////// 205 var ehArray = ehArray2 = [], 206 i = 0; 207 208 $('.equal-height').each (function(){ 209 var $ehc = $(this); 210 if ($ehc.has ('.equal-height')) { 211 ehArray2[ehArray2.length] = $ehc; 212 } else { 213 ehArray[ehArray.length] = $ehc; 214 } 215 }); 216 for (i = ehArray2.length -1; i >= 0; i--) { 217 ehArray[ehArray.length] = ehArray2[i]; 218 } 219 220 var equalHeight = function() { 221 for (i = 0; i < ehArray.length; i++) { 222 var $cols = ehArray[i].children().filter('.col'), 223 maxHeight = 0; 224 $cols.css('min-height', 0).each (function() { 225 maxHeight = Math.max(maxHeight, $(this).innerHeight()); 226 }); 227 $cols.css('min-height', maxHeight); 228 } 229 // store current size 230 $('.equal-height > .col').each (function(){ 231 var $col = $(this); 232 $col.data('old-width', $col.width()).data('old-height', $col.innerHeight()); 233 }); 234 }; 235 236 equalHeight(); 237 238 // monitor col width and fire equalHeight 239 setInterval(function() { 240 $('.equal-height > .col').each(function(){ 241 var $col = $(this); 242 if (($col.data('old-width') && $col.data('old-width') != $col.width()) || 243 ($col.data('old-height') && $col.data('old-height') != $col.innerHeight())) { 244 equalHeight(); 245 // break each loop 246 return false; 247 } 248 }); 249 }, 500); 250 251 // special fix link popup for acymailing module. will remove when acymailing update fix for front end edit module. 252 var acy_site = $('html.com_config').find('#t3-content').find('#modules-form').find('#jform_params_moduleclass_sfx').val(); 253 if (acy_site == 'acy-email-footer') { 254 $('html.com_config').find('#t3-content').find('#modules-form').find('a.modal').each(function(i, e) { 255 var acylhref = ja_base_uri+'/administrator/index.php?option=com_acymailing&tmpl=component&ctrl=chooselist&task='+$(this).prev().attr('id')+'&values='+$(this).prev().val()+'&control='; 256 if (!($(this).attr('href').search("acyba.com") > 0)) { 257 $(this).attr('href', acylhref); 258 } 259 }); 260 } 261 // end special fix link popup for acymailing module. 262 263 // temporary fix for acm popup module. 264 $('html.com_config div#ja-acm-admin div#jatools-videos').find('a.modal').each(function(i, e) { 265 var acms = $(this).attr('href'); 266 var acmn = acms.indexOf('?'); 267 acms = acms.substring(parseInt(acmn)+1); 268 $(this).attr('href', ja_base_uri+'/administrator/index.php?'+acms); 269 }); 270 271 // fix ipad calendar not close when click outsite calendar. 272 $('html.com_users').on({ 'touchstart' : function(){ 273 if (!$(event.target).closest(".calendar").length) { 274 $('.calendar').hide(); 275 } 276 }}); 277});
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.