1/* globals 2 jQuery, CsLogger 3 */ 4/* exported 5 */ 6"use strict"; 7(function ($, window, document, undefined) { 8 9 // default settings. 10 var _pluginName = "embeddedWebPage"; 11 var _defaultsOptions = { 12 debug: false, 13 rotateInterval: 5000, 14 rotateFxDuration: 2000, 15 enableParallax: false 16 }; 17 var _logger = new CsLogger(_pluginName); 18 19 // constructor. 20 function EmbeddedWebPage(element, options) { 21 this._element = element; 22 23 // $.extend to store user provided options. 24 this._options = $.extend({}, _defaultsOptions, options); 25 this._defaultOptions = _defaultsOptions; 26 this._name = _pluginName; 27 this.init(); 28 } 29 30 // (void) ensure the selected element is valid. 31 function validateElement(element) { 32 _logger.log("validateElement()"); 33 if (element == undefined || $(element).length == 0) { 34 _logger.error("selected element is not valid."); 35 return; 36 } 37 } 38 39 // (void) validate the options passed into the plugin. 40 function validateOptions(options) { 41 if (typeof (options.debug) == "boolean" && options.debug == true) { 42 _logger.enable(); 43 } 44 if (typeof (options.enableParallax) == "boolean") { 45 _defaultsOptions.enableParallax = options.enableParallax; 46 } 47 _logger.obj("validateOptions() | opts:", options); 48 } 49 50 // prototype extensions. 51 EmbeddedWebPage.prototype = { 52 53 // (void) initialise. 54 init: function () { 55 validateOptions(this._options); 56 validateElement(this._element); 57 _logger.log("init()"); 58 } 59 }; 60 61 // A really lightweight plugin wrapper around the constructor, 62 // preventing against multiple instantiations 63 $.fn[_pluginName] = function (options) { 64 return this.each(function () { 65 if (!$.data(this, "plugin_" + _pluginName)) { 66 $.data(this, "plugin_" + _pluginName, 67 new EmbeddedWebPage(this, options)); 68 } 69 }); 70 }; 71 72})(jQuery, window, 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.