芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/rentandbuyrealty.com/mobile/lib/gsap/src/uncompressed/plugins/TextPlugin.js
/*! * VERSION: 0.5.0 * DATE: 2013-07-10 * UPDATES AND DOCS AT: http://www.greensock.com * * @license Copyright (c) 2008-2014, GreenSock. All rights reserved. * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for * Club GreenSock members, the software agreement that was issued with your membership. * * @author: Jack Doyle, jack@greensock.com */ (window._gsQueue || (window._gsQueue = [])).push( function() { "use strict"; var _getText = function(e) { var type = e.nodeType, result = ""; if (type === 1 || type === 9 || type === 11) { if (typeof(e.textContent) === "string") { return e.textContent; } else { for ( e = e.firstChild; e; e = e.nextSibling ) { result += _getText(e); } } } else if (type === 3 || type === 4) { return e.nodeValue; } return result; }, TextPlugin = window._gsDefine.plugin({ propName: "text", API: 2, version:"0.5.0", //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. init: function(target, value, tween) { var i, shrt; if (!("innerHTML" in target)) { return false; } this._target = target; if (typeof(value) !== "object") { value = {value:value}; } if (value.value === undefined) { this._text = this._original = [""]; return true; } this._delimiter = value.delimiter || ""; this._original = _getText(target).replace(/\s+/g, " ").split(this._delimiter); this._text = value.value.replace(/\s+/g, " ").split(this._delimiter); this._runBackwards = (tween.vars.runBackwards === true); if (this._runBackwards) { i = this._original; this._original = this._text; this._text = i; } if (typeof(value.newClass) === "string") { this._newClass = value.newClass; this._hasClass = true; } if (typeof(value.oldClass) === "string") { this._oldClass = value.oldClass; this._hasClass = true; } i = this._original.length - this._text.length, shrt = (i < 0) ? this._original : this._text; this._fillChar = value.fillChar || (value.padSpace ? " " : ""); if (i < 0) { i = -i; } while (--i > -1) { shrt.push(this._fillChar); } return true; }, //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.) set: function(ratio) { if (ratio > 1) { ratio = 1; } else if (ratio < 0) { ratio = 0; } if (this._runBackwards) { ratio = 1 - ratio; } var l = this._text.length, i = (ratio * l + 0.5) | 0, applyNew, applyOld, str; if (this._hasClass) { applyNew = (this._newClass && i !== 0); applyOld = (this._oldClass && i !== l); str = (applyNew ? "
" : "") + this._text.slice(0, i).join(this._delimiter) + (applyNew ? "
" : "") + (applyOld ? "
" : "") + this._delimiter + this._original.slice(i).join(this._delimiter) + (applyOld ? "
" : ""); } else { str = this._text.slice(0, i).join(this._delimiter) + this._delimiter + this._original.slice(i).join(this._delimiter); } this._target.innerHTML = (this._fillChar === " " && str.indexOf(" ") !== -1) ? str.split(" ").join(" ") : str; } }), p = TextPlugin.prototype; p._newClass = p._oldClass = p._delimiter = ""; }); if (window._gsDefine) { window._gsQueue.pop()(); }