1// JavaScript document; Author (c) Cyber Fox 2012 /* auto-UTF-8: Å¡ÄÅžýŠÄÅŽà */ 2// For documentation see: ./jsdoc/index.html 3 4/*jslint forin: true, plusplus: true, sloppy: true, regexp: true, browser: true, nomen: true, todo: true */ 5/*global jQuery, FOXFRAME, CYBERFOX, LANG, DEBUG, alert, _, _translate, confirm, ActiveXObject */ 6 7/** 8 * @fileOverview This file contains all objects and procedures related to <b>FoxFrame JS</b> framework. The script uses 9 * Douglas Crockford's JavaScript module pattern, see Eric Miraglia's <a href="http://www.yuiblog.com/blog/2007/06/12/module-pattern/">A JavaScript Module Pattern</a> explanation. 10 * The documentation has been created automatically using <a href="http://code.google.com/p/jsdoc-toolkit/">JSDoc-Toolkit</a>. 11 * 12 * @package FoxFrame JS 13 14 * @copyright Copyright (c) Cyber Fox, s.r.o. 2012-present (http://www.cyberfox.cz/). All rights reserved. 15 * @license This file is a part of FoxFrame. You may not copy, publish, license, sell, distribute, modify, reproduce, transfer or create derivative works 16 * from this file except without prior written permission copyrights owner. You may not alter or remove any trademark, copyright or other notice from this file or 17 * from any web page content (HTML) that is generated by program logic in this file. 18 * 19 * @version 04.02.2013 17:24:09 20 * @author janrenn <[email protected]> 21 * 22 * @todo filtry jako 2ascii nebo typography apod. umoznit spoustet nejen nad stringem, ale i nad DOM/jQuery elementem 23 * @todo filtr, ktery prida globalne CSS tridy podle tagName (napr. "zbootstrapizuje tabulky") 24 * @todo mozna neco z prace s datem 25 */ 26 27/** 28 * Reads CSS classes (or ID's): 29 * class_name | which elements are scanned | purpose | name_of_JS_method | depends on 30 * 31 * noselection,no-selection,noselect,no-select | any element | onLoad = disables selection on this elements | prepareDom | jQuery UI 32 * target-blank | A | modifies title to increase usability; onClick = opens target in new browser window/tab | prepareDom 33 * title-nomodify | A | prevents usability modifications on title | prepareDom 34 * add-fav | any element | onClick = adds page to browser's favourites | prepareDom 35 * fade-in-onload | any element | onLoad = shows elements using fade-in animation | prepareDom 36 * fade-in-onloadmouse | any element | onLoad + mouseOver on BODY = shows elements using fade-in animation | prepareDom 37 * focus-onload | any element | onLoad = focuses thus marked element, first in DOM if many | prepareDom 38 * fix-eolas | any element wrapping Flash | onLoad = in Opera element's inner HTML will be removed and put back to fix EOLAS restriction | prepareDom 39 * effect-color-[color RGB hexadecimal definition] | any element | onLoad = flashes element with "highlite" effect, starting with color set after hyphen (e.g. effect-color-ffee66) | prepareDom 40 * typography | any element | onLoad = replaces element's inner HTML with some typographic corrections | prepareDom 41 * typography-remove-empty | any element | onLoad = replaces element's inner HTML with some typographic corrections, removing empty <p> | prepareDom 42 * catchmousedown | see 'mousedown' 43 */ 44 45/** 46 * Adds CSS classes: 47 * class_name | onto which elements | purpose | name_of_JS_method | depends on 48 * 49 * opera | BODY | added if client is Opera | addBodyClasses 50 * chrome | BODY | added if client is Chrome | addBodyClasses 51 * safari | BODY | added if client is Safari | addBodyClasses 52 * webkit | BODY | added if client is based on Webkit core (Chrome, Safari, ...) | addBodyClasses 53 * msie ie | BODY | added if client is IE | addBodyClasses 54 * not-ie | BODY | added if client is NOT IE | addBodyClasses 55 * ie<client_major_version> | BODY | if client is IE, this class name informs about its major version | addBodyClasses 56 * mozilla | BODY | added if client is FF/SeaMonkey/Mozilla | addBodyClasses 57 * old-browser | BODY | added if client doesn't support CSS3 (say about) | addBodyClasses 58 * jquery | BODY | added if jQuery global function is present (replaces no-jquery) | addBodyClasses 59 * foxframe | BODY | added everytime is method addBodyClasses used (replaces no-foxframe) | addBodyClasses 60 * cyberfox | BODY | added if global object CYBERFOX is present (replaces no-cyberfox) | addB
60odyClasses 61 * touch | BODY | added if UA is on touch-screen device | addBodyClasses 62 * mobile | BODY | added if UA is on mobile device | addBodyClasses 63 * ios | BODY | added if UA is on iOS | addBodyClasses 64 * android | BODY | added if UA is on Android | addBodyClasses 65 * new-win | A with class target-blank or target="_blank" | added to mark new window opening links | prepareDom 66 * out | A with href^="http" and linking to another host | added to mark links aiming outside our site | prepareDom 67 * wraps-image | A | marks links, containing IMG element | prepareDom 68 * mousedown | A or element with class "catchmousedown" | added to recognize this link/element state | prepareDom 69 */ 70 71 72// check requirements 73if (typeof jQuery === 'function') { 74 75 /** 76 * Object that works as wrapper for all FOXFRAME JavaScript functionality. 77 * Can contain miscellaneous FOXFRAME framework related properties 78 * or methods. 79 * 80 * jQuery 1.9.x compatible 81 * 82 * @version 1.20 83 * @namespace FoxFrame JS framework namespace. 84 */ 85 var FOXFRAME = {}; 86 87 88 /** 89 * FOXFRAME version.
90 * @type String 91 */ 92 FOXFRAME.version = '1.20'; 93 94 95 /** 96 * Keeps old jQuery < 1.9 $.browser property 97 * To work with legacy plugins, foxframe.js has to be linked immediately after jquery.js 98 */ 99 (function () { 100 var matched, 101 browser; 102 jQuery.uaMatch = function (ua) { 103 var match; 104 ua = ua.toLowerCase(); 105 match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 106 /(webkit)[ \/]([\w.]+)/.exec(ua) || 107 /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 108 /(msie) ([\w.]+)/.exec(ua) || 109 (ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)) || 110 []; 111 return { 112 browser: match[1] || "", 113 version: match[2] || "0" 114 }; 115 }; 116 matched = jQuery.uaMatch(navigator.userAgent); 117 browser = {}; 118 if (matched.browser) { 119 browser[matched.browser] = true; 120 browser.version = matched.version; 121 } 122 // Chrome is Webkit, but Webkit is also Safari. 123 if (browser.chrome) { 124 browser.webkit = true; 125 } else if (browser.webkit) { 126 browser.safari = true; 127 } 128 jQuery.browser = browser; 129 }()); 130 131 132 /** 133 * Environment variables. 134 * @type Object 135 */ 136 FOXFRAME.env = { 137 protocol: window.location.protocol.replace(/:$/, ''), 138 url: window.location.href, 139 host: window.location.host, 140 query: window.location.search.replace(/^\?/, ''), 141 hash: window.location.hash.replace(/^#/, ''), 142 ie: !!jQuery.browser.msie,
143 ie6: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 6), 144 ie7: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 7), 145 ie8: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 8), 146 ie9: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 9), 147 ie10: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) === 10), 148 oldIe: !!(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 9), 149 webkit: !!jQuery.browser.webkit, 150 opera: !!jQuery.browser.opera, 151 mozilla: !!jQuery.browser.mozilla, 152 html5: { 153 audio: (window.HTMLAudioElement !== undefined), 154 video: (window.HTMLVideoElement !== undefined), 155 canvas: (window.HTMLCanvasElement !== undefined) 156 }, 157 cookie: window.navigator.cookieEnabled, 158 flash: (function () { 159 var c, 160 v, 161 p = window.navigator.plugins, 162 k; 163 if (window.ActiveXObject) { 164 try { 165 c = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 166 } catch (e) { 167 return false; 168 } 169 if (c) { 170 v = String(c.GetVariable('$version')); 171 v = v.replace(/,.+$/, '').replace(/[^0-9]/g, ''); 172 return Number(v) || true; 173 } 174 } else if (typeof p === 'object') { 175 for (k in p) { 176 if (/Flash/.test(p[k].description)) { 177 v = p[k].description.replace(/\..+$/, '').replace(/[^0-9]/g, ''); 178 return Number(v) || true; 179 } 180 } 181 } 182 return false; 183 }()), 184 touch: (window.ontouchstart !== undefined || window.onmsgesturechange !== undefined), 185 mobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent), 186 ios: /iPhone|iPad|iPod/i.test(navigator.userAgent), 187 android: /Android/i.test(navigator.userAgent) 188 }; 189 190 191 192 /** 193 * Contains global utilities and helper structures. 194 * 195 * @namespace FoxFrame JS utilities and helper structures module. 196 * 197 * @memberOf FOXFRAME 198 * @author janrenn <[email protected]> 199 * @requires jQuery 1.8.3+ 200 * @requires jQuery.cookie 201 * @param {Function} $ jQuery's alias passed as parameter to prevent 202 * conflict with other libraries using "$" 203 */ 204 FOXFRAME.utils = (function ($) { 205 206 /** 207 * @scope FOXFRAME.utils 208 */ 209 return { 210 211 212 /** 213 * Tries to open link in new browser window and returns outcome. 214 * 215 * @memberOf FOXFRAME.utils 216 * @param {Object} elm HTML link element (A) to open 217 * @returns {Boolean} On new window opening success true, otherwise false 218 */ 219 openInBlank: function (elm) { 220 var w = window.open(elm.href); 221 if (typeof w === 'object') { 222 return false; 223 } 224 return true; 225 }, 226 227 228 /** 229 * Formats number with thousands separator. 230 * 231 * @memberOf FOXFRAME.utils 232 * @param {Number} number Number to format 233 * @param {String} ts Thousands separator 234 * @returns {String} Formatted number 235 */ 236 formatNumber: function (number, ts) { 237 var formated = String(number), 238 reg = /(\d+)(\d{3})/; 239 if (!ts) { 240 return number; 241 } 242 while (reg.test(formated)) { 243 formated = formated.replace(reg, '$1' + ts + '$2'); 244 } 245 return formated; 246 }, 247 248 249 /** 250 * Adds CSS classes to body HTML element. 251 * 252 * @memberOf FOXFRAME.utils 253 * @returns {Boolean} Always true 254 */ 255 addBodyClasses: function () { 256 257 // browser support 258 if ($.browser.opera) { 259 $('body').addClass('opera'); 260 } 261 if ($.browser.webkit || $.browser.safari) { 262 $('body').addClass('webkit'); 263 } 264 if ($.browser.chrome) { 265 $('body').addClass('chrome'); 266 } 267 if ($.browser.safari && !/Chrome/.test(navigator.userAgent)) { 268 $('body').addClass('safari'); 269 } 270 if ($.browser.msie) { 271 $('body').addClass('msie ie'); 272 if (FOXFRAME.env.oldIe) { 273 $('body').addClass('oldie'); 274 } 275 } else { 276 $('body').addClass('not-ie'); 277 } 278 if ($.browser.msie) { 279 $('body').addClass('ie' + parseInt($.browser.version, 10)); 280 } 281 if ($.browser.mozilla) { 282 $('body').addClass('mozilla'); 283 } 284 285 // old-browsers 286 // FF<3, Saf<3, Opera <10.10 287 // http://zytrax.com/tech/web/firefox-history.html 288 if ( 289 ($.browser.mozilla && Number($.browser.version.replace(/[a-z]/g, '').replace('.', '~').replace(/\./g, '').replace('~', '.')) < 1.9) 290 || (($.browser.webkit || $.browser.safari) && parseInt($.browser.version, 10) < 531) 291 || ($.browser.opera && Number($.browser.version) < 10.10) 292 ) { 293 $('body').addClass('old-browser'); 294 } 295 296 // common 297 $('body').removeClass('no-jquery').addClass('jquery'); 298 $('body').removeClass('no-foxframe').addClass('foxframe'); 299 if (typeof CYBERFOX === 'object') { 300 $('body').removeClass('no-cyberfox').addClass('cyberfox'); 301 } 302 303 // touch & mobiles 304 if (FOXFRAME.env.touch) { 305 $('body').addClass('touch'); 306 } 307 if (FOXFRAME.env.mobile) { 308 $('body').addClass('mobile'); 309 } 310 if (FOXFRAME.env.ios) { 311 $('body').addClass('ios'); 312 } 313 if (FOXFRAME.env.android) { 314 $('body').addClass('android'); 315 } 316 317 return true; 318 }, 319 320 321 /** 322 * Makes changes in DOM and registrates helper functions. 323 * 324 * @memberOf FOXFRAME.utils 325 * @params {*} startElement DOM element, jQuery selector or jQuery object to use as context 326 * @returns {Boolean} Always true 327 */ 328 prepareDom: function (startElement) { 329 var that = this; 330 startElement = startElement || $(document); 331 startElement = (startElement instanceof jQuery ? startElement : $(startElement)); 332 333 // common 334 if (typeof $.ui === 'object') { 335 $('.noselection, .no-selection, .noselect, .no-select', startElement).disableSelection(); 336 } 337 338 // disabled elements 339 startElement.on('click mouseover mouseout mousemove mousedown mouseup focus', '*[disabled], .disabled', function (e) { 340 e.stopPropagation(); 341 return false; 342 }); 343 344 // no selection 345 startElement.on('selectstart', '*[disabled], .disabled, .noselection, .no-selection, .noselect, .no-select, .button', function (e) { 346 e.stopPropagation(); 347 return false; 348 }); 349 350 // target blank 351 // open links with class "target-blank" in new browser window/tab 352 $('a.target-blank', startElement).on('click', function () { 353 return that.openInBlank(this); 354 }); 355 356 // add class to style link element in older browsers 357 // add or modify "title" to increase usability 358 $('a.target-blank, a[target="_blank"]', startElement).addClass('new-win').not('.title-nomodify').attr('title', function () { 359 var t = $(this).attr('title'), 360 h = $(this).attr('href'), 361 n = _('opens in new window'), 362 nt; 363 if (t) { 364 nt = (t + ' (' + n + ')'); 365 } else if (h && /(^htt(p|ps):\/\/)/.test(h)) { 366 nt = (h.replace(/(^htt(p|ps):\/\/)/, '').replace(/\/(.*)$/, '') + ' (' + n + ')'); 367 } 368 nt = nt || n;
369 $(this).find('img').attr('title', nt); 370 return nt; 371 }); 372 373 // animated scroll to top 374 $('a[href="#top"]', startElement).on('click', function () { 375 var sel = (window.opera ? 'html' : 'html,body'); 376 $(sel).animate({ 377 scrollTop: 0 378 }, 100); 379 return false; 380 }); 381 382 // init add-fav 383 // registers "A" elements with class "add-fav" as add-to-favs buttons 384 if ($.browser.opera) { 385 $('.add-fav', startElement).attr('rel', 'sidebar'); 386 } 387 $('.add-fav', startElement).on('click', function () { 388 var t = $(this), 389 url = document.location.href, 390 title = document.title; 391 if (document.all && !window.opera) { 392 window.external.AddFavorite(url, title); 393 return false; 394 } 395 if (window.opera && window.print) { 396 t.attr('title', title); 397 return true; 398 } 399 if ((typeof window.sidebar === 'object') && (typeof window.sidebar.addPanel === 'function')) { 400 window.sidebar.addPanel(title, url, ''); 401 return false; 402 } 403 }); 404 405 // class out 406 // add class to style link pointing out of site in older browsers 407 $('a[href^="http"]', startElement).addClass(function () { 408 var h = $(this).attr('href'); 409 h = h.replace(/^http(s)?:\/\//, '').replace(/\/.*$/, '').replace(/:.*$/, ''); 410 if (h !== FOXFRAME.env.host) { 411 return 'out'; 412 } 413 return ''; 414 }); 415 $('a[href^="https"]', startElement).addClass('https'); 416 $('a[href^="ftp"]', startElement).addClass('ftp'); 417 418 // no blank or out for images 419 // marks "A" element wrapping any "IMG" with "wraps-image" class 420 $('img', startElement).parents('a').addClass('wraps-image'); 421 422 // load shims & polyfill plugins 423 // use jQuery plugin to fix html5 placeholder functionality in oldies 424 // has to be run before focus-onload callback! 425 if (typeof $.fn.placeholder === 'function') { 426 $('input[placeholder], textarea[placeholder]').placeholder().blur(); 427 } 428 429 // on document ready fades-in marked elements 430 setTimeout(function () { 431 $('.fade-in-onload', startElement).fadeIn(300).removeClass('fade-in-onload'); 432 }, 400); 433 434 // on document ready fades-in marked elements 435 startElement.on('mouseover', function () { 436 $('.fade-in-onload-mouse').fadeIn(300).removeClass('fade-in-onload-mouse'); 437 }); 438 439 // on document ready focuses error or marked elements 440 setTimeout(function () { 441 if ($('.error input, .error select, .error textarea', startElement).length === 0) { 442 $('.focus-onload', startElement).each(function () { 443 var t = $(this); 444 if (t.val() === '' || t.val() === t.attr('placeholder')) { 445 // wait for $.fn.placeholder 446 setTimeout(function () { 447 t.focus(); 448 }, (FOXFRAME.env.ie && !FOXFRAME.env.ie10 ? 300 : 1)); 449 return false; 450 } 451 }); 452 } else { 453 $('.error input, .error select, .error textarea', startElement)[0].focus(); 454 } 455 }, 2); 456 457 // applies Flash EOLAS fix for Opera 458 if ($.browser.opera) { 459 $('.fix-eolas', startElement).each(function () { 460 var t = $(this), 461 html = t.html(); 462 t.html(html); 463 }); 464 } 465 466 // set some onload effects 467 if (typeof $.effects === 'object') { 468 $('[class*="effect-color-"]', startElement).each(function () { 469 var t = $(this), 470 c = 'yellow'; 471 if (/effect\-color\-([a-fA-F0-9]{3}|[a-fA-F0-9]{6})( |$)/.test(t.attr('class'))) { 472 c = '#' + t.attr('class').replace(/.*(^| )effect\-color\-([a-fA-F0-9]{3,6})( |$).*/, '$2'); 473 } 474 t.effect('highlight', { 475 color: c 476 }, 1200); 477 }); 478 } 479 480 // class mousedown 481 $('a, .catchmousedown', startElement).on('mousedown', function () { 482 $(this).addClass('mousedown'); 483 }).on('mouseup mouseout', function () { 484 $(this).removeClass('mousedown'); 485 }); 486 487 // last-child 488 if (FOXFRAME.env.oldIe) { 489 $('div:last-child, li:last-child', startElement).addClass('last-child'); 490 } 491 492 // some typography 493 $('.typography, .typography-remove-empty', startElement).each(function () { 494 var t = $(this), 495 html = String(t.html()); 496 html = that.typography(html, t.is('.typography-remove-empty')); 497 t.html(html); 498 }); 499 500 501 return true; 502 }, 503 504 505 /** 506 * Applies some basic typographic rules on text. 507 * 508 * @param {String} text Text the rules should be applied on 509 * @param {Boolean} removeEmpty Whether to remove empty <p>s 510 * @returns {String} Adjusted text 511 * @version 0.1 512 * @author janrenn <[email protected]> 513 */ 514 typography: function (text, removeEmpty) {//return text; 515 text = text.replace(/ (i|k|o|s|u|v|z|I|K|O|S|U|V|Z|A) /g, ' $1\u00a0').replace(/ (sv\.|Sv\.|ing\.|Ing\.|Dr\.|MUDr\.|JUDr\.|Doc\.|Mgr\.|Bc\.) /g, ' $1\u00a0'); 516 text = text.replace(/([0-9]) (m|cm|km|kg|g|KÄ|CZK|USD|$|EUR|min|l|ml|kWh)(<|.|,|\s)/g, '$1\u00a0$2$3').replace(/([0-9]),(-|â|â) /g, '$1,â\u00a0').replace(/KÄ ([0-9])/g, 'KÄ\u00a0$1'); 517 if (removeEmpty) { 518 text = text.replace(/ /g, ' ').replace(/ /g, ' ').replace(/<p[^>]*>[ \s]*<\/p>/gi, ''); 519 } 520 return text; 521 }, 522 523 524 /** 525 * Converts UTF-8 string into ASCII. 526 * 527 * @param {String} text UTF-8 text to be converted 528 * @returns {String} converted ASCII string 529 * @version 0.1 530 * @author janrenn <[email protected]> 531 */ 532 utf2ascii: function (text) { 533 var utf = ' ââââ\'()-_ââ.,;!-+=*#%@0123456789ÃAÃÃÃÃÄBCÄÃÄDÄEÃÄÃÃÃÃÄFGHIÃÃÃJKLÅMNÅÃÅOÃÃÃPQRÅSÅ ÅTŤUÃÅ®ÃÃVWXYßZŽŹŻ' 534 + 'aÃ¡Ã Ã¢Ã¤Ä bcÄÄçdÄeéÄéèêëÄfghiÃïîjklÅmnÅñÅoóôöpqrÅsÅ¡ÅtÅ¥uúůûüvwxyýÿzžźżÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐРСТУФХЦЧШЩЪЫЬÐЮЯ' 535 + 'абвгдеÑжзийклмнопÑÑÑÑÑÑ ÑÑÑÑÑÑÑÑÑÑ', 536 ascii = ' """\'\'()-_--.,;!-+=*#%@0123456789sAAAAAABCCCCDDEEEEEEEEFGHIIIIJKLLMNNNNOOOOPQRRSSSTTUUUUUVWXYYYZZZZ' 537 + 'aaaaaabccccddeeeeeeeefghiiiijkllmnnnnoooopqrrsssttuuuuuvwxyyyzzzzABVGDEOZZIJKLMNOPRSTUFHCCSSYYIEUA' 538 + 'abvgdeozzijklmnoprstufhccssyyieua', 539 i; 540 for (i = 0; i < text.length; i++) { 541 text = text.replace(text[i], (ascii[utf.indexOf(text[i])] || '?')); 542 } 543 return text; 544 }, 545 546 547 /** 548 * Converts UTF-8 string into URL/filename safe lowercase ASCII string. 549 * 550 * @requires FOXFRAME.utils.utf2ascii 551 * @param {String} text UTF-8 text to be converted 552 * @param {Number} allowedLength maximal allowed length, unsigned integer 553 * @param {String} allowedChars list of allowed characters 554 * @param {Boolean} allowOptimization try to cut string between words (can increment allowed length
554with 1) 555 * @returns {String} converted string 556 * @version 0.1 557 * @author janrenn <[email protected]> 558 */ 559 webalize: function (text, allowedLength, allowedChars, allowOptimization) { 560 var al = allowedLength || 64, 561 ach = allowedChars || '0123456789abcdefghijklmnopqrstuvwxyz', 562 ao = Boolean(allowOptimization), 563 i; 564 ao = Number(ao); 565 text = $.trim(text); 566 text = text.toLowerCase(); 567 text = FOXFRAME.utils.utf2ascii(text); 568 for (i = 0; i < text.length; i++) { 569 text = text.replace(text[i], (ach.indexOf(text[i]) > 0 ? text[i] : '-')); 570 } 571 text = text.replace(/-+/g, '-').replace(/(^-|-$)/g, ''); 572 if (text.length <= al) { 573 return text; 574 } 575 text = text.substr(0, al + ao); 576 text = (/-$/.test(text) ? text.replace(/-$/, '') : text.replace(/-[^\-]+-?$/, '')); 577 text = (ao && /-/.test(text) ? text : text.substr(0, al)); 578 return text; 579 }, 580 581 582 /** 583 * Method for getting, setting or removing variables from URL query string. 584 * Use jQuery.param and BBQ's deparam instead! 585 */ 586 587 588 /** 589 * Translates string into the currently displayed page language. 590 * The method is copied to global function <b>_</b> for easier use. 591 * 592 * @see _global_.window._ 593 * @memberOf FOXFRAME.utils 594 * @param {String} s Original string to translate 595 * @returns {String} Translated string 596 */ 597 translate: function (s) { 598 if ( 599 FOXFRAME._translate[LANG] !== undefined 600 && FOXFRAME._translate[LANG][s] !== undefined 601 && FOXFRAME._translate[LANG][s] 602 ) { 603 return FOXFRAME._translate[LANG][s]; 604 } 605 return s; 606 }, 607 608 609 /** 610 * Initializes FOXFRAME.utils module. 611 * 612 * @memberOf FOXFRAME.utils 613 */ 614 init: function () { 615 616 } 617 618 619 // closing scope 620 }; 621 622 // module works as jQuery wrapper 623 }(jQuery)); 624 625 626 627 /** 628 * GoRound, generic carousel. 629 * 630 * @namespace FoxFrame generic carousel module. 631 * 632 * @memberOf FOXFRAME 633 * @author janrenn <[email protected]> 634 * @requires jQuery 1.8.3+ 635 */ 636 FOXFRAME.goround = (function ($) { 637 638 /** 639 * @private 640 */ 641 var that = this, 642 defaults = { 643 644 }; 645 646 /** 647 * @scope FOXFRAME.goround 648 */ 649 return { 650 651 /** 652 * Initializes FOXFRAME.goround module. 653 * 654 * @memberOf FOXFRAME.goround 655 * @param {} 656 * @returns {Boolean} 657 */ 658 init: function () { 659 660 return true; 661 } 662 663 664 // closing scope 665 }; 666 667 // module works as jQuery wrapper 668 }(jQuery)); 669 670 671 672 /** 673 * Localization object. 674 * Contains translations strings. 675 * 676 * @type Object 677 * @memberOf FOXFRAME 678 */ 679 FOXFRAME._translate = {}; 680 681 /** 682 * Copies function <b>FOXFRAME.utils.translate</b> 683 * into the global scope. 684 * 685 * @see FOXFRAME.utils.translate 686 * @memberOf _global_ 687 */ 688 window._ = FOXFRAME.utils.translate; 689 690 691 // initialise on document ready 692 jQuery(document).ready(function () { 693 FOXFRAME.utils.init(); 694 }); 695 696} else { 697 alert('Load jQuery first.'); 698} 699 700// end of document
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.