/web/src/main/resources/public/scripts/js-all-min.js
JavaScript | 1319 lines | 679 code | 195 blank | 445 comment | 78 complexity | cb7626a0aea9a591d77f223fc843663f MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
- /**
- * @fileoverview Functions for setting, getting and deleting cookies
- */
- /**
- * Namespace for cookie functions
- */
- // TODO: find the official solution for a cookies library
- var shindig = shindig || {};
- shindig.cookies = shindig.cookies || {};
- shindig.cookies.JsType_ = {
- UNDEFINED: 'undefined'
- };
- shindig.cookies.isDef = function(val) {
- return typeof val != shindig.cookies.JsType_.UNDEFINED;
- };
- /**
- * Sets a cookie.
- * The max_age can be -1 to set a session cookie. To remove and expire cookies,
- * use remove() instead.
- *
- * @param {string} name The cookie name.
- * @param {string} value The cookie value.
- * @param {number} opt_maxAge The max age in seconds (from now). Use -1 to set
- * a session cookie. If not provided, the default is
- * -1 (i.e. set a session cookie).
- * @param {string} opt_path The path of the cookie, or null to not specify a
- * path attribute (browser will use the full request
- * path). If not provided, the default is '/' (i.e.
- * path=/).
- * @param {string} opt_domain The domain of the cookie, or null to not specify
- * a domain attribute (browser will use the full
- * request host name). If not provided, the default
- * is null (i.e. let browser use full request host
- * name).
- */
- shindig.cookies.set = function(name, value, opt_maxAge, opt_path, opt_domain) {
- // we do not allow '=' or ';' in the name
- if (/;=/g.test(name)) {
- throw new Error('Invalid cookie name "' + name + '"');
- }
- // we do not allow ';' in value
- if (/;/g.test(value)) {
- throw new Error('Invalid cookie value "' + value + '"');
- }
- if (!shindig.cookies.isDef(opt_maxAge)) {
- opt_maxAge = -1;
- }
- var domainStr = opt_domain ? ';domain=' + opt_domain : '';
- var pathStr = opt_path ? ';path=' + opt_path : '';
- var expiresStr;
- // Case 1: Set a session cookie.
- if (opt_maxAge < 0) {
- expiresStr = '';
- // Case 2: Expire the cookie.
- // Note: We don't tell people about this option in the function doc because
- // we prefer people to use ExpireCookie() to expire cookies.
- } else if (opt_maxAge === 0) {
- // Note: Don't use Jan 1, 1970 for date because NS 4.76 will try to convert
- // it to local time, and if the local time is before Jan 1, 1970, then the
- // browser will ignore the Expires attribute altogether.
- var pastDate = new Date(1970, 1 /*Feb*/, 1); // Feb 1, 1970
- expiresStr = ';expires=' + pastDate.toUTCString();
- // Case 3: Set a persistent cookie.
- } else {
- var futureDate = new Date((new Date).getTime() + opt_maxAge * 1000);
- expiresStr = ';expires=' + futureDate.toUTCString();
- }
- document.cookie = name + '=' + value + domainStr + pathStr + expiresStr;
- };
- /**
- * Returns the value for the first cookie with the given name
- * @param {string} name The name of the cookie to get
- * @param {string} opt_default If not found this is returned instead.
- * @return {string|undefined} The value of the cookie. If no cookie is set this
- * returns opt_default or undefined if opt_default is
- * not provided.
- */
- shindig.cookies.get = function(name, opt_default) {
- var nameEq = name + "=";
- var cookie = String(document.cookie);
- for (var pos = -1; (pos = cookie.indexOf(nameEq, pos + 1)) >= 0;) {
- var i = pos;
- // walk back along string skipping whitespace and looking for a ; before
- // the name to make sure that we don't match cookies whose name contains
- // the given name as a suffix.
- while (--i >= 0) {
- var ch = cookie.charAt(i);
- if (ch == ';') {
- i = -1; // indicate success
- break;
- }
- }
- if (i == -1) { // first cookie in the string or we found a ;
- var end = cookie.indexOf(';', pos);
- if (end < 0) {
- end = cookie.length;
- }
- return cookie.substring(pos + nameEq.length, end);
- }
- }
- return opt_default;
- };
- /**
- * Removes and expires a cookie.
- *
- * @param {string} name The cookie name.
- * @param {string} opt_path The path of the cookie, or null to expire a cookie
- * set at the full request path. If not provided, the
- * default is '/' (i.e. path=/).
- * @param {string} opt_domain The domain of the cookie, or null to expire a
- * cookie set at the full request host name. If not
- * provided, the default is null (i.e. cookie at
- * full request host name).
- */
- shindig.cookies.remove = function(name, opt_path, opt_domain) {
- var rv = shindig.cookies.containsKey(name);
- shindig.cookies.set(name, '', 0, opt_path, opt_domain);
- return rv;
- };
- /**
- * Gets the names and values for all the cookies
- * @private
- * @return {Object} An object with keys and values
- */
- shindig.cookies.getKeyValues_ = function() {
- var cookie = String(document.cookie);
- var parts = cookie.split(/\s*;\s*/);
- var keys = [], values = [], index, part;
- for (var i = 0; part = parts[i]; i++) {
- index = part.indexOf('=');
- if (index == -1) { // empty name
- keys.push('');
- values.push(part);
- } else {
- keys.push(part.substring(0, index));
- values.push(part.substring(index + 1));
- }
- }
- return {keys: keys, values: values};
- };
- /**
- * Gets the names for all the cookies
- * @return {Array} An array with the names of the cookies
- */
- shindig.cookies.getKeys = function() {
- return shindig.cookies.getKeyValues_().keys;
- };
- /**
- * Gets the values for all the cookies
- * @return {Array} An array with the values of the cookies
- */
- shindig.cookies.getValues = function() {
- return shindig.cookies.getKeyValues_().values;
- };
- /**
- * Whether there are any cookies for this document
- * @return {boolean}
- */
- shindig.cookies.isEmpty = function() {
- return document.cookie === '';
- };
- /**
- * Returns the number of cookies for this document
- * @return {number}
- */
- shindig.cookies.getCount = function() {
- var cookie = String(document.cookie);
- if (cookie === '') {
- return 0;
- }
- var parts = cookie.split(/\s*;\s*/);
- return parts.length;
- };
- /**
- * Returns whether there is a cookie with the given name
- * @param {string} key The name of the cookie to test for
- * @return {boolean}
- */
- shindig.cookies.containsKey = function(key) {
- var sentinel = {};
- // if get does not find the key it returns the default value. We therefore
- // compare the result with an object to ensure we do not get any false
- // positives.
- return shindig.cookies.get(key, sentinel) !== sentinel;
- };
- /**
- * Returns whether there is a cookie with the given value. (This is an O(n)
- * operation.)
- * @param {string} value The value to check for
- * @return {boolean}
- */
- shindig.cookies.containsValue = function(value) {
- // this O(n) in any case so lets do the trivial thing.
- var values = shindig.cookies.getKeyValues_().values;
- for (var i = 0; i < values.length; i++) {
- if (values[i] == value) {
- return true;
- }
- }
- return false;
- };
- /**
- * Removes all cookies for this document
- */
- shindig.cookies.clear = function() {
- var keys = shindig.cookies.getKeyValues_().keys;
- for (var i = keys.length - 1; i >= 0; i--) {
- shindig.cookies.remove(keys[i]);
- }
- };
- /**
- * Static constant for the size of cookies. Per the spec, there's a 4K limit
- * to the size of a cookie. To make sure users can't break this limit, we
- * should truncate long cookies at 3950 bytes, to be extra careful with dumb
- * browsers/proxies that interpret 4K as 4000 rather than 4096
- * @type number
- */
- shindig.cookies.MAX_COOKIE_LENGTH = 3950;
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
- /**
- * @fileoverview Utility functions for the Open Gadget Container
- */
- Function.prototype.inherits = function(parentCtor) {
- function tempCtor() {};
- tempCtor.prototype = parentCtor.prototype;
- this.superClass_ = parentCtor.prototype;
- this.prototype = new tempCtor();
- this.prototype.constructor = this;
- };/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
- /**
- * @fileoverview Open Gadget Container
- */
- var gadgets = gadgets || {};
- gadgets.error = {};
- gadgets.error.SUBCLASS_RESPONSIBILITY = 'subclass responsibility';
- gadgets.error.TO_BE_DONE = 'to be done';
- gadgets.log = function(message) {
- if (window.console && console.log) {
- console.log(message);
- } else {
- var logEntry = document.createElement('div');
- logEntry.className = 'gadgets-log-entry';
- logEntry.innerHTML = message;
- document.body.appendChild(logEntry);
- }
- };
- /**
- * Calls an array of asynchronous functions and calls the continuation
- * function when all are done.
- * @param {Array} functions Array of asynchronous functions, each taking
- * one argument that is the continuation function that handles the result
- * That is, each function is something like the following:
- * function(continuation) {
- * // compute result asynchronously
- * continuation(result);
- * }
- * @param {Function} continuation Function to call when all results are in. It
- * is pass an array of all results of all functions
- * @param {Object} opt_this Optional object used as "this" when calling each
- * function
- */
- gadgets.callAsyncAndJoin = function(functions, continuation, opt_this) {
- var pending = functions.length;
- var results = [];
- for (var i = 0; i < functions.length; i++) {
- // we need a wrapper here because i changes and we need one index
- // variable per closure
- var wrapper = function(index) {
- functions[index].call(opt_this, function(result) {
- results[index] = result;
- if (--pending === 0) {
- continuation(results);
- }
- });
- };
- wrapper(i);
- }
- };
- // ----------
- // Extensible
- gadgets.Extensible = function() {
- };
- /**
- * Sets the dependencies.
- * @param {Object} dependencies Object whose properties are set on this
- * container as dependencies
- */
- gadgets.Extensible.prototype.setDependencies = function(dependencies) {
- for (var p in dependencies) {
- this[p] = dependencies[p];
- }
- };
- /**
- * Returns a dependency given its name.
- * @param {String} name Name of dependency
- * @return {Object} Dependency with that name or undefined if not found
- */
- gadgets.Extensible.prototype.getDependencies = function(name) {
- return this[name];
- };
- // -------------
- // UserPrefStore
- /**
- * User preference store interface.
- * @constructor
- */
- gadgets.UserPrefStore = function() {
- };
- /**
- * Gets all user preferences of a gadget.
- * @param {Object} gadget Gadget object
- * @return {Object} All user preference of given gadget
- */
- gadgets.UserPrefStore.prototype.getPrefs = function(gadget) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- /**
- * Saves user preferences of a gadget in the store.
- * @param {Object} gadget Gadget object
- * @param {Object} prefs User preferences
- */
- gadgets.UserPrefStore.prototype.savePrefs = function(gadget) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- // -------------
- // DefaultUserPrefStore
- /**
- * User preference store implementation.
- * TODO: Turn this into a real implementation that is production safe
- * @constructor
- */
- gadgets.DefaultUserPrefStore = function() {
- gadgets.UserPrefStore.call(this);
- };
- gadgets.DefaultUserPrefStore.inherits(gadgets.UserPrefStore);
- gadgets.DefaultUserPrefStore.prototype.getPrefs = function(gadget) { };
- gadgets.DefaultUserPrefStore.prototype.savePrefs = function(gadget) { };
- // -------------
- // GadgetService
- /**
- * Interface of service provided to gadgets for resizing gadgets,
- * setting title, etc.
- * @constructor
- */
- gadgets.GadgetService = function() {
- };
- gadgets.GadgetService.prototype.setHeight = function(elementId, height) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- gadgets.GadgetService.prototype.setTitle = function(gadget, title) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- gadgets.GadgetService.prototype.setUserPref = function(id) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- // ----------------
- // IfrGadgetService
- /**
- * Base implementation of GadgetService.
- * @constructor
- */
- gadgets.IfrGadgetService = function() {
- gadgets.GadgetService.call(this);
- gadgets.rpc.register('resize_iframe', this.setHeight);
- gadgets.rpc.register('set_pref', this.setUserPref);
- gadgets.rpc.register('set_title', this.setTitle);
- gadgets.rpc.register('requestNavigateTo', this.requestNavigateTo);
- };
- gadgets.IfrGadgetService.inherits(gadgets.GadgetService);
- gadgets.IfrGadgetService.prototype.setHeight = function(height) {
- if (height > gadgets.container.maxheight_) {
- height = gadgets.container.maxheight_;
- }
- var element = document.getElementById(this.f);
- if (element) {
- element.style.height = height + 'px';
- }
- };
- gadgets.IfrGadgetService.prototype.setTitle = function(title) {
- var element = document.getElementById(this.f + '_title');
- if (element) {
- element.innerHTML = title.replace(/&/g, '&').replace(/</g, '<');
- }
- };
- /**
- * Sets one or more user preferences
- * @param {String} editToken
- * @param {String} name Name of user preference
- * @param {String} value Value of user preference
- * More names and values may follow
- */
- gadgets.IfrGadgetService.prototype.setUserPref = function(editToken, name,
- value) {
- var id = gadgets.container.gadgetService.getGadgetIdFromModuleId(this.f);
- var gadget = gadgets.container.getGadget(id);
- var prefs = gadget.getUserPrefs() || {};
- for (var i = 1, j = arguments.length; i < j; i += 2) {
- prefs[arguments[i]] = arguments[i + 1];
- }
- gadget.setUserPrefs(prefs);
- };
- /**
- * Navigates the page to a new url based on a gadgets requested view and
- * parameters.
- */
- gadgets.IfrGadgetService.prototype.requestNavigateTo = function(view,
- opt_params) {
- var id = gadgets.container.gadgetService.getGadgetIdFromModuleId(this.f);
- var url = gadgets.container.gadgetService.getUrlForView(view);
- if (opt_params) {
- var paramStr = gadgets.json.stringify(opt_params);
- if (paramStr.length > 0) {
- url += '&appParams=' + encodeURIComponent(paramStr);
- }
- }
- if (url && document.location.href.indexOf(url) == -1) {
- document.location.href = url;
- }
- };
- /**
- * This is a silly implementation that will need to be overriden by almost all
- * real containers.
- * TODO: Find a better default for this function
- *
- * @param view The view name to get the url for
- */
- gadgets.IfrGadgetService.prototype.getUrlForView = function(
- view) {
- if (view === 'canvas') {
- return '/canvas';
- } else if (view === 'profile') {
- return '/profile';
- } else {
- return null;
- }
- };
- gadgets.IfrGadgetService.prototype.getGadgetIdFromModuleId = function(
- moduleId) {
- // Quick hack to extract the gadget id from module id
- return parseInt(moduleId.match(/_([0-9]+)$/)[1], 10);
- };
- // -------------
- // LayoutManager
- /**
- * Layout manager interface.
- * @constructor
- */
- gadgets.LayoutManager = function() {
- };
- /**
- * Gets the HTML element that is the chrome of a gadget into which the content
- * of the gadget can be rendered.
- * @param {Object} gadget Gadget instance
- * @return {Object} HTML element that is the chrome for the given gadget
- */
- gadgets.LayoutManager.prototype.getGadgetChrome = function(gadget) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- // -------------------
- // StaticLayoutManager
- /**
- * Static layout manager where gadget ids have a 1:1 mapping to chrome ids.
- * @constructor
- */
- gadgets.StaticLayoutManager = function() {
- gadgets.LayoutManager.call(this);
- };
- gadgets.StaticLayoutManager.inherits(gadgets.LayoutManager);
- /**
- * Sets chrome ids, whose indexes are gadget instance ids (starting from 0).
- * @param {Array} gadgetChromeIds Gadget id to chrome id map
- */
- gadgets.StaticLayoutManager.prototype.setGadgetChromeIds =
- function(gadgetChromeIds) {
- this.gadgetChromeIds_ = gadgetChromeIds;
- };
- gadgets.StaticLayoutManager.prototype.getGadgetChrome = function(gadget) {
- var chromeId = this.gadgetChromeIds_[gadget.id];
- return chromeId ? document.getElementById(chromeId) : null;
- };
- // ----------------------
- // FloatLeftLayoutManager
- /**
- * FloatLeft layout manager where gadget ids have a 1:1 mapping to chrome ids.
- * @constructor
- * @param {String} layoutRootId Id of the element that is the parent of all
- * gadgets.
- */
- gadgets.FloatLeftLayoutManager = function(layoutRootId) {
- gadgets.LayoutManager.call(this);
- this.layoutRootId_ = layoutRootId;
- };
- gadgets.FloatLeftLayoutManager.inherits(gadgets.LayoutManager);
- gadgets.FloatLeftLayoutManager.prototype.getGadgetChrome =
- function(gadget) {
- var layoutRoot = document.getElementById(this.layoutRootId_);
- if (layoutRoot) {
- var chrome = document.createElement('div');
- chrome.className = 'gadgets-gadget-chrome';
- chrome.style.cssFloat = 'left';
- layoutRoot.appendChild(chrome);
- return chrome;
- } else {
- return null;
- }
- };
- // ------
- // Gadget
- /**
- * Creates a new instance of gadget. Optional parameters are set as instance
- * variables.
- * @constructor
- * @param {Object} params Parameters to set on gadget. Common parameters:
- * "specUrl": URL to gadget specification
- * "private": Whether gadget spec is accessible only privately, which means
- * browser can load it but not gadget server
- * "spec": Gadget Specification in XML
- * "viewParams": a javascript object containing attribute value pairs
- * for this gadgets
- * "secureToken": an encoded token that is passed on the URL hash
- * "hashData": Query-string like data that will be added to the
- * hash portion of the URL.
- * "specVersion": a hash value used to add a v= param to allow for better caching
- * "title": the default title to use for the title bar.
- * "height": height of the gadget
- * "width": width of the gadget
- * "debug": send debug=1 to the gadget server, gets us uncompressed
- * javascript
- */
- gadgets.Gadget = function(params) {
- this.userPrefs_ = {};
- if (params) {
- for (var name in params) if (params.hasOwnProperty(name)) {
- this[name] = params[name];
- }
- }
- if (!this.secureToken) {
- // Assume that the default security token implementation is
- // in use on the server.
- this.secureToken = 'john.doe:john.doe:appid:cont:url:0:default';
- }
- };
- gadgets.Gadget.prototype.getUserPrefs = function() {
- return this.userPrefs_;
- };
- gadgets.Gadget.prototype.setUserPrefs = function(userPrefs) {
- this.userPrefs_ = userPrefs;
- gadgets.container.userPrefStore.savePrefs(this);
- };
- gadgets.Gadget.prototype.getUserPref = function(name) {
- return this.userPrefs_[name];
- };
- gadgets.Gadget.prototype.setUserPref = function(name, value) {
- this.userPrefs_[name] = value;
- gadgets.container.userPrefStore.savePrefs(this);
- };
- gadgets.Gadget.prototype.render = function(chrome) {
- if (chrome) {
- var gadget = this;
- this.getContent(function(content) {
- chrome.innerHTML = content;
- window.frames[gadget.getIframeId()].location = gadget.getIframeUrl();
- });
- }
- };
- gadgets.Gadget.prototype.getContent = function(continuation) {
- gadgets.callAsyncAndJoin([
- this.getTitleBarContent, this.getUserPrefsDialogContent,
- this.getMainContent], function(results) {
- continuation(results.join(''));
- }, this);
- };
- /**
- * Gets title bar content asynchronously or synchronously.
- * @param {Function} continuation Function that handles title bar content as
- * the one and only argument
- */
- gadgets.Gadget.prototype.getTitleBarContent = function(continuation) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- /**
- * Gets user preferences dialog content asynchronously or synchronously.
- * @param {Function} continuation Function that handles user preferences
- * content as the one and only argument
- */
- gadgets.Gadget.prototype.getUserPrefsDialogContent = function(continuation) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- /**
- * Gets gadget content asynchronously or synchronously.
- * @param {Function} continuation Function that handles gadget content as
- * the one and only argument
- */
- gadgets.Gadget.prototype.getMainContent = function(continuation) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- /*
- * Gets additional parameters to append to the iframe url
- * Override this method if you need any custom params.
- */
- gadgets.Gadget.prototype.getAdditionalParams = function() {
- return '';
- };
- // ---------
- // IfrGadget
- gadgets.IfrGadget = function(opt_params) {
- gadgets.Gadget.call(this, opt_params);
- this.serverBase_ = '../../'; // default gadget server
- };
- gadgets.IfrGadget.inherits(gadgets.Gadget);
- gadgets.IfrGadget.prototype.GADGET_IFRAME_PREFIX_ = 'remote_iframe_';
- gadgets.IfrGadget.prototype.CONTAINER = 'default';
- gadgets.IfrGadget.prototype.cssClassGadget = 'gadgets-gadget';
- gadgets.IfrGadget.prototype.cssClassTitleBar = 'gadgets-gadget-title-bar';
- gadgets.IfrGadget.prototype.cssClassTitle = 'gadgets-gadget-title';
- gadgets.IfrGadget.prototype.cssClassTitleButtonBar =
- 'gadgets-gadget-title-button-bar';
- gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialog =
- 'gadgets-gadget-user-prefs-dialog';
- gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialogActionBar =
- 'gadgets-gadget-user-prefs-dialog-action-bar';
- gadgets.IfrGadget.prototype.cssClassTitleButton = 'gadgets-gadget-title-button';
- gadgets.IfrGadget.prototype.cssClassGadgetContent = 'gadgets-gadget-content';
- gadgets.IfrGadget.prototype.rpcToken = (0x7FFFFFFF * Math.random()) | 0;
- gadgets.IfrGadget.prototype.rpcRelay = 'files/container/rpc_relay.html';
- gadgets.IfrGadget.prototype.getTitleBarContent = function(continuation) {
- continuation('<div id="' + this.cssClassTitleBar + '-' + this.id +
- '" class="' + this.cssClassTitleBar + '"><span id="' +
- this.getIframeId() + '_title" class="' +
- this.cssClassTitle + '">' + (this.title ? this.title : 'Title') + '</span> | <span class="' +
- this.cssClassTitleButtonBar +
- '"><a href="#" onclick="gadgets.container.getGadget(' + this.id +
- ').handleOpenUserPrefsDialog();return false;" class="' + this.cssClassTitleButton +
- '">settings</a> <a href="#" onclick="gadgets.container.getGadget(' +
- this.id + ').handleToggle();return false;" class="' + this.cssClassTitleButton +
- '">toggle</a></span></div>');
- };
- gadgets.IfrGadget.prototype.getUserPrefsDialogContent = function(continuation) {
- continuation('<div id="' + this.getUserPrefsDialogId() + '" class="' +
- this.cssClassGadgetUserPrefsDialog + '"></div>');
- };
- gadgets.IfrGadget.prototype.setServerBase = function(url) {
- this.serverBase_ = url;
- };
- gadgets.IfrGadget.prototype.getServerBase = function() {
- return this.serverBase_;
- };
- gadgets.IfrGadget.prototype.getMainContent = function(continuation) {
- var iframeId = this.getIframeId();
- gadgets.rpc.setRelayUrl(iframeId, this.serverBase_ + this.rpcRelay);
- gadgets.rpc.setAuthToken(iframeId, this.rpcToken);
- continuation('<div class="' + this.cssClassGadgetContent + '"><iframe id="' +
- iframeId + '" name="' + iframeId + '" class="' + this.cssClassGadget +
- '" src="about:blank' +
- '" frameborder="no" scrolling="no"' +
- (this.height ? ' height="' + this.height + '"' : '') +
- (this.width ? ' width="' + this.width + '"' : '') +
- '></iframe></div>');
- };
- gadgets.IfrGadget.prototype.getIframeId = function() {
- return this.GADGET_IFRAME_PREFIX_ + this.id;
- };
- gadgets.IfrGadget.prototype.getUserPrefsDialogId = function() {
- return this.getIframeId() + '_userPrefsDialog';
- };
- gadgets.IfrGadget.prototype.getIframeUrl = function() {
- return this.serverBase_ + 'ifr?' +
- 'container=' + this.CONTAINER +
- '&mid=' + this.id +
- '&nocache=' + gadgets.container.nocache_ +
- '&country=' + gadgets.container.country_ +
- '&lang=' + gadgets.container.language_ +
- '&view=' + gadgets.container.view_ +
- (this.specVersion ? '&v=' + this.specVersion : '') +
- (gadgets.container.parentUrl_ ? '&parent=' + encodeURIComponent(gadgets.container.parentUrl_) : '') +
- (this.debug ? '&debug=1' : '') +
- this.getAdditionalParams() +
- this.getUserPrefsParams() +
- (this.secureToken ? '&st=' + this.secureToken : '') +
- '&url=' + encodeURIComponent(this.specUrl) +
- '#rpctoken=' + this.rpcToken +
- (this.viewParams ?
- '&view-params=' + encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
- (this.hashData ? '&' + this.hashData : '');
- };
- gadgets.IfrGadget.prototype.getUserPrefsParams = function() {
- var params = '';
- if (this.getUserPrefs()) {
- for(var name in this.getUserPrefs()) {
- var value = this.getUserPref(name);
- params += '&up_' + encodeURIComponent(name) + '=' +
- encodeURIComponent(value);
- }
- }
- return params;
- };
- gadgets.IfrGadget.prototype.handleToggle = function() {
- var gadgetIframe = document.getElementById(this.getIframeId());
- if (gadgetIframe) {
- var gadgetContent = gadgetIframe.parentNode;
- var display = gadgetContent.style.display;
- gadgetContent.style.display = display ? '' : 'none';
- }
- };
- gadgets.IfrGadget.prototype.handleOpenUserPrefsDialog = function() {
- if (this.userPrefsDialogContentLoaded) {
- this.showUserPrefsDialog();
- } else {
- var gadget = this;
- var igCallbackName = 'ig_callback_' + this.id;
- window[igCallbackName] = function(userPrefsDialogContent) {
- gadget.userPrefsDialogContentLoaded = true;
- gadget.buildUserPrefsDialog(userPrefsDialogContent);
- gadget.showUserPrefsDialog();
- };
- var script = document.createElement('script');
- script.src = 'http://gmodules.com/ig/gadgetsettings?mid=' + this.id +
- '&output=js' + this.getUserPrefsParams() + '&url=' + this.specUrl;
- document.body.appendChild(script);
- }
- };
- gadgets.IfrGadget.prototype.buildUserPrefsDialog = function(content) {
- var userPrefsDialog = document.getElementById(this.getUserPrefsDialogId());
- userPrefsDialog.innerHTML = content +
- '<div class="' + this.cssClassGadgetUserPrefsDialogActionBar +
- '"><input type="button" value="Save" onclick="gadgets.container.getGadget(' +
- this.id +').handleSaveUserPrefs()"> <input type="button" value="Cancel" onclick="gadgets.container.getGadget(' +
- this.id +').handleCancelUserPrefs()"></div>';
- userPrefsDialog.childNodes[0].style.display = '';
- };
- gadgets.IfrGadget.prototype.showUserPrefsDialog = function(opt_show) {
- var userPrefsDialog = document.getElementById(this.getUserPrefsDialogId());
- userPrefsDialog.style.display = (opt_show || opt_show === undefined)
- ? '' : 'none';
- };
- gadgets.IfrGadget.prototype.hideUserPrefsDialog = function() {
- this.showUserPrefsDialog(false);
- };
- gadgets.IfrGadget.prototype.handleSaveUserPrefs = function() {
- this.hideUserPrefsDialog();
- var prefs = {};
- var numFields = document.getElementById('m_' + this.id +
- '_numfields').value;
- for (var i = 0; i < numFields; i++) {
- var input = document.getElementById('m_' + this.id + '_' + i);
- if (input.type != 'hidden') {
- var userPrefNamePrefix = 'm_' + this.id + '_up_';
- var userPrefName = input.name.substring(userPrefNamePrefix.length);
- var userPrefValue = input.value;
- prefs[userPrefName] = userPrefValue;
- }
- }
- this.setUserPrefs(prefs);
- this.refresh();
- };
- gadgets.IfrGadget.prototype.handleCancelUserPrefs = function() {
- this.hideUserPrefsDialog();
- };
- gadgets.IfrGadget.prototype.refresh = function() {
- var iframeId = this.getIframeId();
- document.getElementById(iframeId).src = this.getIframeUrl();
- };
- // ---------
- // Container
- /**
- * Container interface.
- * @constructor
- */
- gadgets.Container = function() {
- this.gadgets_ = {};
- this.parentUrl_ = 'http://' + document.location.host;
- this.country_ = 'ALL';
- this.language_ = 'ALL';
- this.view_ = 'default';
- this.nocache_ = 1;
- // signed max int
- this.maxheight_ = 0x7FFFFFFF;
- };
- gadgets.Container.inherits(gadgets.Extensible);
- /**
- * Known dependencies:
- * gadgetClass: constructor to create a new gadget instance
- * userPrefStore: instance of a subclass of gadgets.UserPrefStore
- * gadgetService: instance of a subclass of gadgets.GadgetService
- * layoutManager: instance of a subclass of gadgets.LayoutManager
- */
- gadgets.Container.prototype.gadgetClass = gadgets.Gadget;
- gadgets.Container.prototype.userPrefStore = new gadgets.DefaultUserPrefStore();
- gadgets.Container.prototype.gadgetService = new gadgets.GadgetService();
- gadgets.Container.prototype.layoutManager =
- new gadgets.StaticLayoutManager();
- gadgets.Container.prototype.setParentUrl = function(url) {
- this.parentUrl_ = url;
- };
- gadgets.Container.prototype.setCountry = function(country) {
- this.country_ = country;
- };
- gadgets.Container.prototype.setNoCache = function(nocache) {
- this.nocache_ = nocache;
- };
- gadgets.Container.prototype.setLanguage = function(language) {
- this.language_ = language;
- };
- gadgets.Container.prototype.setView = function(view) {
- this.view_ = view;
- };
- gadgets.Container.prototype.setMaxHeight = function(maxheight) {
- this.maxheight_ = maxheight;
- };
- gadgets.Container.prototype.getGadgetKey_ = function(instanceId) {
- return 'gadget_' + instanceId;
- };
- gadgets.Container.prototype.getGadget = function(instanceId) {
- return this.gadgets_[this.getGadgetKey_(instanceId)];
- };
- gadgets.Container.prototype.createGadget = function(opt_params) {
- return new this.gadgetClass(opt_params);
- };
- gadgets.Container.prototype.addGadget = function(gadget) {
- gadget.id = this.getNextGadgetInstanceId();
- gadget.setUserPrefs(this.userPrefStore.getPrefs(gadget));
- this.gadgets_[this.getGadgetKey_(gadget.id)] = gadget;
- };
- gadgets.Container.prototype.addGadgets = function(gadgets) {
- for (var i = 0; i < gadgets.length; i++) {
- this.addGadget(gadgets[i]);
- }
- };
- /**
- * Renders all gadgets in the container.
- */
- gadgets.Container.prototype.renderGadgets = function() {
- for (var key in this.gadgets_) {
- this.renderGadget(this.gadgets_[key]);
- }
- };
- /**
- * Renders a gadget. Gadgets are rendered inside their chrome element.
- * @param {Object} gadget Gadget object
- */
- gadgets.Container.prototype.renderGadget = function(gadget) {
- throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
- };
- gadgets.Container.prototype.nextGadgetInstanceId_ = 0;
- gadgets.Container.prototype.getNextGadgetInstanceId = function() {
- return this.nextGadgetInstanceId_++;
- };
- /**
- * Refresh all the gadgets in the container.
- */
- gadgets.Container.prototype.refreshGadgets = function() {
- for (var key in this.gadgets_) {
- this.gadgets_[key].refresh();
- }
- };
- // ------------
- // IfrContainer
- /**
- * Container that renders gadget using ifr.
- * @constructor
- */
- gadgets.IfrContainer = function() {
- gadgets.Container.call(this);
- };
- gadgets.IfrContainer.inherits(gadgets.Container);
- gadgets.IfrContainer.prototype.gadgetClass = gadgets.IfrGadget;
- gadgets.IfrContainer.prototype.gadgetService = new gadgets.IfrGadgetService();
- gadgets.IfrContainer.prototype.setParentUrl = function(url) {
- if (!url.match(/^http[s]?:\/\//)) {
- url = document.location.href.match(/^[^?#]+\//)[0] + url;
- }
- this.parentUrl_ = url;
- };
- /**
- * Renders a gadget using ifr.
- * @param {Object} gadget Gadget object
- */
- gadgets.IfrContainer.prototype.renderGadget = function(gadget) {
- var chrome = this.layoutManager.getGadgetChrome(gadget);
- gadget.render(chrome);
- };
- /**
- * Default container.
- */
- gadgets.container = new gadgets.IfrContainer();
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
- /**
- * @fileoverview Implements the gadgets.UserPrefStore interface using a cookies
- * based implementation. Depends on cookies.js. This code should not be used in
- * a production environment.
- */
- /**
- * Cookie-based user preference store.
- * @constructor
- */
- gadgets.CookieBasedUserPrefStore = function() {
- gadgets.UserPrefStore.call(this);
- };
- gadgets.CookieBasedUserPrefStore.inherits(gadgets.UserPrefStore);
- gadgets.CookieBasedUserPrefStore.prototype.USER_PREFS_PREFIX =
- 'gadgetUserPrefs-';
- gadgets.CookieBasedUserPrefStore.prototype.getPrefs = function(gadget) {
- var userPrefs = {};
- var cookieName = this.USER_PREFS_PREFIX + gadget.id;
- var cookie = shindig.cookies.get(cookieName);
- if (cookie) {
- var pairs = cookie.split('&');
- for (var i = 0; i < pairs.length; i++) {
- var nameValue = pairs[i].split('=');
- var name = decodeURIComponent(nameValue[0]);
- var value = decodeURIComponent(nameValue[1]);
- userPrefs[name] = value;
- }
- }
- return userPrefs;
- };
- gadgets.CookieBasedUserPrefStore.prototype.savePrefs = function(gadget) {
- var pairs = [];
- for (var name in gadget.getUserPrefs()) {
- var value = gadget.getUserPref(name);
- var pair = encodeURIComponent(name) + '=' + encodeURIComponent(value);
- pairs.push(pair);
- }
- var cookieName = this.USER_PREFS_PREFIX + gadget.id;
- var cookieValue = pairs.join('&');
- shindig.cookies.set(cookieName, cookieValue);
- };
- gadgets.Container.prototype.userPrefStore =
- new gadgets.CookieBasedUserPrefStore();
- /*
- Copyright (c) 2009, Yahoo! Inc. All rights reserved.
- Code licensed under the BSD License:
- http://developer.yahoo.net/yui/license.txt
- version: 2.7.0
- */
- if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}A=B.match(/Caja\/([^\s]*)/);if(A&&A[1]){C.caja=parseFloat(A[1]);}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,F="[object Array]",C="[object Function]",A=Object.prototype,E=["toString","valueOf"],D={isArray:function(G){return A.toString.apply(G)===F;},isBoolean:function(G){return typeof G==="boolean";},isFunction:function(G){return A.toString.apply(G)===C;},isNull:function(G){return G===null;},isNumber:function(G){return typeof G==="number"&&isFinite(G);},isObject:function(G){return(G&&(typeof G==="object"||B.isFunction(G)))||false;},isString:function(G){return typeof G==="string";},isUndefined:function(G){return typeof G==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(I,H){var G,K,J;for(G=0;G<E.length;G=G+1){K=E[G];J=H[K];if(B.isFunction(J)&&J!=A[K]){I[K]=J;}}}:function(){},extend:function(J,K,I){if(!K||!J){throw new Error("extend failed, please check that "+"all dependencies are included.");}var H=function(){},G;H.prototype=K.prototype;J.prototype=new H();J.prototype.constructor=J;J.superclass=K.prototype;if(K.prototype.constructor==A.constructor){K.prototype.constructor=K;}if(I){for(G in I){if(B.hasOwnProperty(I,G)){J.prototype[G]=I[G];}}B._IEEnumFix(J.prototype,I);}},augmentObject:function(K,J){if(!J||!K){throw new Error("Absorb failed, verify dependencies.");}var G=arguments,I,L,H=G[2];if(H&&H!==true){for(I=2;I<G.length;I=I+1){K[G[I]]=J[G[I]];}}else{for(L in J){if(H||!(L in K)){K[L]=J[L];}}B._IEEnumFix(K,J);}},augmentProto:function(J,I){if(!I||!J){throw new Error("Augment failed, verify dependencies.");}var G=[J.prototype,I.prototype],H;for(H=2;H<arguments.length;H=H+1){G.push(arguments[H]);}B.augmentObject.apply(this,G);},dump:function(G,L){var I,K,N=[],O="{...}",H="f(){...}",M=", ",J=" => ";if(!B.isObject(G)){return G+"";}else{if(G instanceof Date||("nodeType" in G&&"tagName" in G)){return G;}else{if(B.isFunction(G)){return H;}}}L=(B.isNumber(L))?L:3;if(B.isArray(G)){N.push("[");for(I=0,K=G.length;I<K;I=I+1){if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}if(N.length>1){N.pop();}N.push("]");}else{N.push("{");for(I in G){if(B.hasOwnProperty(G,I)){N.push(I+J);if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}}if(N.length>1){N.pop();}N.push("}");}return N.join("");},substitute:function(V,H,O){var L,K,J,R,S,U,Q=[],I,M="dump",P=" ",G="{",T="}",N;for(;;){L=V.lastIndexOf(G);if(L<0){break;}K=V.indexOf(T,L);if(L+1>=K){break;}I=V.substring(L+1,K);R=I;U=null;J=R.indexOf(P);if(J>-1){U=R.substring(J+1);R=R.substring(0,J);}S=H[R];if(O){S=O(R,S,U);}if(B.isObject(S)){if(B.isArray(S)){S=B.dump(S,parseInt(U,10));}else{U=U||"";N=U.indexOf(M);if(N>-1){U=U.substring(4);}if(S.toString===A.toString||N>-1){S=B.dump(S,parseInt(U,10));}else{S=S.toString();}}}else{if(!B.isString(S)&&!B.isNumber(S)){S="~-"+Q.length+"-~";Q[Q.length]=I;}}V=V.substring(0,L)+S+V.substring(K+1);}for(L=Q.length-1;L>=0;L=L-1){V=V.replace(new RegExp("~-"+L+"-~"),"{"+Q[L]+"}","g");}return V;},trim:function(G){try{return G.replace(/^\s+|\s+$/g,"");}catch(H){return G;}},merge:function(){var J={},H=arguments,G=H.length,I;for(I=0;I<G;I=I+1){B.augmentObject(J,H[I],true);}return J;},later:function(N,H,O,J,K){N=N||0;H=H||{};var I=O,M=J,L,G;if(B.isString(O)){I=H[O];}if(!I){throw new TypeError("method undefined");}if(!B.isArray(M)){M=[J];}L=function(){I.apply(H,M);};G=(K)?setInterval(L,N):setTimeout(L,N);return{interval:K,cancel:function(){if(this.interval){clearInterval(G);}else{clearTimeout(G);}}};},isValue:function(G){return(B.isObject(G)||B.isString(G)||B.isNumber(G)||B.isBoolean(G));}};B.hasOwnProperty=(A.hasOwnProperty)?function(G,H){return G&&G.hasOwnProperty(H);}:function(G,H){return !B.isUndefined(G[H])&&G.constructor.prototype[H]!==G[H];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.7.0",build:"1796"});(function(){YAHOO.env._id_counter=YAHOO.env._id_counter||0;var E=YAHOO.util,L=YAHOO.lang,m=YAHOO.env.ua,A=YAHOO.lang.trim,d={},h={},N=/^t(?:able|d|h)$/i,X=/color$/i,K=window.document,W=K.documentElement,e="ownerDocument",n="defaultView",v="documentElement",t="compatMode",b="offsetLeft",P="offsetTop",u="offsetParent",Z="parentNode",l="nodeType",C="tagName",O="scrollLeft",i="scrollTop",Q="getBoundingClientRect",w="getComputedStyle",a="currentStyle",M="CSS1Compat",c="BackCompat",g="class",F="className",J="",B=" ",s="(?:^|\\s)",k="(?= |$)",U="g",p="position",f="fixed",V="relative",j="left",o="top",r="medium",q="borderLeftWidth",R="borderTopWidth",D=m.opera,I=m.webkit,H=m.gecko,T=m.ie;E.Dom={CUSTOM_ATTRIBUTES:(!W.hasAttribute)?{"for":"htmlFor","class":F}:{"htmlFor":"for","className":g},get:function(y){var AA,Y,z,x,G;if(y){if(y[l]||y.item){return y;}if(typeof y==="string"){AA=y;y=K.getElementById(y);if(y&&y.id===AA){return y;}else{if(y&&K.all){y=null;Y=K.all[AA];for(x=0,G=Y.length;x<G;++x){if(Y[x].id===AA){return Y[x];}}}}return y;}if(y.DOM_EVENTS){y=y.get("element");}if("length" in y){z=[];for(x=0,G=y.length;x<G;++x){z[z.length]=E.Dom.get(y[x]);}return z;}return y;}return null;},getComputedStyle:function(G,Y){if(window[w]){return G[e][n][w](G,null)[Y];}else{if(G[a]){return E.Dom.IE_ComputedStyle.get(G,Y);}}},getStyle:function(G,Y){return E.Dom.batch(G,E.Dom._getStyle,Y);},_getStyle:function(){if(window[w]){return function(G,y){y=(y==="float")?y="cssFloat":E.Dom._toCamel(y);var x=G.style[y],Y;if(!x){Y=G[e][n][w](G,null);if(Y){x=Y[y];}}return x;};}else{if(W[a]){return function(G,y){var x;switch(y){case"opacity":x=100;try{x=G.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(z){try{x=G.filters("alpha").opacity;}catch(Y){}}return x/100;case"float":y="styleFloat";default:y=E.Dom._toCamel(y);x=G[a]?G[a][y]:null;return(G.style[y]||x);}};}}}(),setStyle:function(G,Y,x){E.Dom.batch(G,E.Dom._setStyle,{prop:Y,val:x});},_setStyle:function(){if(T){return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){switch(x){case"opacity":if(L.isString(Y.style.filter)){Y.style.filter="alpha(opacity="+y*100+")";if(!Y[a]||!Y[a].hasLayout){Y.style.zoom=1;}}break;case"float":x="styleFloat";default:Y.style[x]=y;}}else{}};}else{return function(Y,G){var x=E.Dom._toCamel(G.prop),y=G.val;if(Y){if(x=="float"){x="cssFloat";}Y.style[x]=y;}else{}};}}(),getXY:function(G){return E.Dom.batch(G,E.Dom._getXY);},_canPosition:function(G){return(E.Dom._getStyle(G,"display")!=="none"&&E.Dom._inDoc(G));},_getXY:function(){if(K[v][Q]){return function(y){var z,Y,AA,AF,AE,AD,AC,G,x,AB=Math.floor,AG=false;if(E.Dom._canPosition(y)){AA=y[Q]();AF=y[e];z=E.Dom.getDocumentScrollLeft(AF);Y=E.Dom.getDocumentScrollTop(AF);AG=[AB(AA[j]),AB(AA[o])];if(T&&m.ie<8){AE=2;AD=2;AC=AF[t];G=S(AF[v],q);x=S(AF[v],R);if(m.ie===6){if(AC!==c){AE=0;AD=0;}}if((AC==c)){if(G!==r){AE=parseInt(G,10);}if(x!==r){AD=parseInt(x,10);}}AG[0]-=AE;AG[1]-=AD;}if((Y||z)){AG[0]+=z;AG[1]+=Y;}AG[0]=AB(AG[0]);AG[1]=AB(AG[1]);}else{}return AG;};}else{return function(y){var x,Y,AA,AB,AC,z=false,G=y;if(E.Dom._canPosition(y)){z=[y[b],y[P]];x=E.Dom.getDocumentScrollLeft(y[e]);Y=E.Dom.getDocumentScrollTop(y[e]);AC=((H||m.webkit>519)?true:false);while((G=G[u])){z[0]+=G[b];z[1]+=G[P];if(AC){z=E.Dom._calcBorders(G,z);}}if(E.Dom._getStyle(y,p)!==f){G=y;while((G=G[Z])&&G[C]){AA=G[i];AB=G[O];if(H&&(E.Dom._getStyle(G,"overflow")!=="visible")){z=E.Dom._calcBorders(G,z);}if(AA||AB){z[0]-=AB;z[1]-=AA;}}z[0]+=x;z[1]+=Y;}else{if(D){z[0]-=x;z[1]-=Y;}else{if(I||H){z[0]+=x;z[1]+=Y;}}}z[0]=Math.floor(z[0]);z[1]=Math.floor(z[1]);}else{}return z;};}}(),getX:function(G){var Y=function(x){return E.Dom.getXY(x)[0];};return E.Dom.batch(G,Y,E.Dom,true);},getY:function(G){var Y=function(x){return E.Dom.getXY(x)[1];};return E.Dom.batch(G,Y,E.Dom,true);},setXY:function(G,x,Y){E.Dom.batch(G,E.Dom._setXY,{pos:x,noRetry:Y});},_setXY:function(G,z){var AA=E.Dom._getStyle(G,p),y=E.Dom.setStyle,AD=z.pos,Y=z.noRetry,AB=[parseInt(E.Dom.getComputedStyle(G,j),10),parseInt(E.Dom.getComputedStyle(G,o),10)],AC,x;if(AA=="static"){AA=V;y(G,p,AA);}AC=E.Dom._getXY(G);if(!AD||AC===false){return false;}if(isNaN(AB[0])){AB[0]=(AA==V)?0:G[b];}if(isNaN(AB[1])){AB[1]=(AA==V)?0:G[P];}if(AD[0]!==null){y(G,j,AD[0]-AC[0]+AB[0]+"px");}if(AD[1]!==null){y(G,o,AD[1]-AC[1]+AB[1]+"px");}if(!Y){x=E.Dom._getXY(G);if((AD[0]!==null&&x[0]!=AD[0])||(AD[1]!==null&&x[1]!=AD[1])){E.Dom._setXY(G,{pos:AD,noRetry:true});}}},setX:function(Y,G){E.Dom.setXY(Y,[G,null]);},setY:function(G,Y){E.Dom.setXY(G,[null,Y]);},getRegion:function(G){var Y=function(x){var y=false;if(E.Dom._canPosition(x)){y=E.Region.getRegion(x);}else{}return y;};return E.Dom.batch(G,Y,E.Dom,true);},getClientWidth:function(){return E.Dom.getViewportWidth();},getClientHeight:function(){return E.Dom.getViewportHeight();},getElementsByClassName:function(AB,AF,AC,AE,x,AD){AB=L.trim(AB);AF=AF||"*";AC=(AC)?E.Dom.get(AC):null||K;if(!AC){return[];}var Y=[],G=AC.getElementsByTagName(AF),z=E.Dom.hasClass;for(var y=0,AA=G.length;y<AA;++y){if(z(G[y],AB)){Y[Y.length]=G[y];}}if(AE){E.Dom.batch(Y,AE,x,AD);}return Y;},hasClass:function(Y,G){return E.Dom.batch(Y,E.Dom._hasClass,G);},_hasClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom.getAttribute(x,F)||J;if(Y.exec){G=Y.test(y);}else{G=Y&&(B+y+B).indexOf(B+Y+B)>-1;}}else{}return G;},addClass:function(Y,G){return E.Dom.batch(Y,E.Dom._addClass,G);},_addClass:function(x,Y){var G=false,y;if(x&&Y){y=E.Dom.getAttribute(x,F)||J;if(!E.Dom._hasClass(x,Y)){E.Dom.setAttribute(x,F,A(y+B+Y));G=true;}}else{}return G;},removeClass:function(Y,G){return E.Dom.batch(Y,E.Dom._removeClass,G);},_removeClass:function(y,x){var Y=false,AA,z,G;if(y&&x){AA=E.Dom.getAttribute(y,F)||J;E.Dom.setAttribute(y,F,AA.replace(E.Dom._getClassRegex(x),J));z=E.Dom.getAttribute(y,F);if(AA!==z){E.Dom.setAttribute(y,F,A(z));Y=true;if(E.Dom.getAttribute(y,F)===""){G=(y.hasAttribute&&y.hasAttribute(g))?g:F;y.removeAttribute(G);}}}else{}return Y;},replaceClass:function(x,Y,G){return E.Dom.batch(x,E.Dom._replaceClass,{from:Y,to:G});
- },_replaceClass:function(y,x){var Y,AB,AA,G=false,z;if(y&&x){AB=x.from;AA=x.to;if(!AA){G=false;}else{if(!AB){G=E.Dom._addClass(y,x.to);}else{if(AB!==AA){z=E.Dom.getAttribute(y,F)||J;Y=(B+z.replace(E.Dom._getClassRegex(AB),B+AA)).split(E.Dom._getClassRegex(AA));Y.splice(1,0,B+AA);E.Dom.setAttribute(y,F,A(Y.join(J)));G=true;}}}}else{}return G;},generateId:function(G,x){x=x||"yui-gen";var Y=function(y){if(y&&y.id){return y.id;}var z=x+YAHOO.env._id_counter++;if(y){if(y[e].getElementById(z)){return E.Dom.generateId(y,z+x);}y.id=z;}return z;};return E.Dom.batch(G,Y,E.Dom,true)||Y.apply(E.Dom,arguments);},isAncestor:function(Y,x){Y=E.Dom.get(Y);x=E.Dom.get(x);var G=false;if((Y&&x)&&(Y[l]&&x[l])){if(Y.contains&&Y!==x){G=Y.contains(x);}else{if(Y.compareDocumentPosition){G=!!(Y.compareDocumentPosition(x)&16);}}}else{}return G;},inDocument:function(G,Y){return E.Dom._inDoc(E.Dom.get(G),Y);},_inDoc:function(Y,x){var G=false;if(Y&&Y[C]){x=x||Y[e];G=E.Dom.isAncestor(x[v],Y);}else{}return G;},getElementsBy:function(Y,AF,AB,AD,y,AC,AE){AF=AF||"*";AB=(AB)?E.Dom.get(AB):null||K;if(!AB){return[];}var x=[],G=AB.getElementsByTagName(AF);for(var z=0,AA=G.length;z<AA;++z){if(Y(G[z])){if(AE){x=G[z];break;}else{x[x.length]=G[z];}}}if(AD){E.Dom.batch(x,AD,y,AC);}return x;},getElementBy:function(x,G,Y){return E.Dom.getElementsBy(x,G,Y,null,null,null,true);},batch:function(x,AB,AA,z){var y=[],Y=(z)?AA:window;x=(x&&(x[C]||x.item))?x:E.Dom.get(x);if(x&&AB){if(x[C]||x.length===undefined){return AB.call(Y,x,AA);}for(var G=0;G<x.length;++G){y[y.length]=AB.call(Y,x[G],AA);}}else{return false;}return y;},getDocumentHeight:function(){var Y=(K[t]!=M||I)?K.body.scrollHeight:W.scrollHeight,G=Math.max(Y,E.Dom.getViewportHeight());return G;},getDocumentWidth:function…
Large files files are truncated, but you can click here to view the full file