Немного мусора, фикс ошибки в r57. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@61 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08 2011-07-02 20:37:23 +00:00
commit dddb6dce07
14 changed files with 1 additions and 6293 deletions

View file

@ -230,7 +230,7 @@ class user_common
$login = (int) ($this->data['user_id'] != ANONYMOUS);
$is_user = ($this->data['user_level'] == USER);
$user_id = (int) $this->data['user_id'];
$mod_admin_session = ($this->data['user_level'] == ADMIN);
$mod_admin_session = ($this->data['user_level'] == IS_AM);
if (($bb_cfg['max_srv_load'] || $bb_cfg['max_reg_users_online']) && $login && $is_user && !$this->data['ignore_srv_load'])
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

View file

@ -1,209 +0,0 @@
html, body {
margin: 0;
background: #FFFFFF;
font-family: Lucida Grande, Tahoma, sans-serif;
font-size: 11px;
overflow: hidden;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.toolbar {
height: 14px;
border-top: 1px solid ThreeDHighlight;
border-bottom: 1px solid ThreeDShadow;
padding: 2px 6px;
background: ThreeDFace;
}
.toolbarRight {
position: absolute;
top: 4px;
right: 6px;
}
#log {
overflow: auto;
position: absolute;
left: 0;
width: 100%;
}
#commandLine {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 18px;
border: none;
border-top: 1px solid ThreeDShadow;
}
/************************************************************************************************/
.logRow {
position: relative;
border-bottom: 1px solid #D7D7D7;
padding: 2px 4px 1px 6px;
background-color: #FFFFFF;
}
.logRow-command {
font-family: Monaco, monospace;
color: blue;
}
.objectBox-null {
padding: 0 2px;
border: 1px solid #666666;
background-color: #888888;
color: #FFFFFF;
}
.objectBox-string {
font-family: Monaco, monospace;
color: red;
white-space: pre;
}
.objectBox-number {
color: #000088;
}
.objectBox-function {
font-family: Monaco, monospace;
color: DarkGreen;
}
.objectBox-object {
color: DarkGreen;
font-weight: bold;
}
/************************************************************************************************/
.logRow-info,
.logRow-error,
.logRow-warning {
background: #FFFFFF no-repeat 2px 2px;
padding-left: 20px;
padding-bottom: 3px;
}
.logRow-info {
background-image: url(infoIcon.png);
}
.logRow-warning {
background-color: cyan;
background-image: url(warningIcon.png);
}
.logRow-error {
background-color: LightYellow;
background-image: url(errorIcon.png);
}
.errorMessage {
vertical-align: top;
color: #FF0000;
}
.objectBox-sourceLink {
position: absolute;
right: 4px;
top: 2px;
padding-left: 8px;
font-family: Lucida Grande, sans-serif;
font-weight: bold;
color: #0000FF;
}
/************************************************************************************************/
.logRow-group {
background: #EEEEEE;
border-bottom: none;
}
.logGroup {
background: #EEEEEE;
}
.logGroupBox {
margin-left: 24px;
border-top: 1px solid #D7D7D7;
border-left: 1px solid #D7D7D7;
}
/************************************************************************************************/
.selectorTag,
.selectorId,
.selectorClass {
font-family: Monaco, monospace;
font-weight: normal;
}
.selectorTag {
color: #0000FF;
}
.selectorId {
color: DarkBlue;
}
.selectorClass {
color: red;
}
/************************************************************************************************/
.objectBox-element {
font-family: Monaco, monospace;
color: #000088;
}
.nodeChildren {
margin-left: 16px;
}
.nodeTag {
color: blue;
}
.nodeValue {
color: #FF0000;
font-weight: normal;
}
.nodeText,
.nodeComment {
margin: 0 2px;
vertical-align: top;
}
.nodeText {
color: #333333;
}
.nodeComment {
color: DarkGreen;
}
/************************************************************************************************/
.propertyNameCell {
vertical-align: top;
}
.propertyName {
font-weight: bold;
}

View file

@ -1,23 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Firebug</title>
<link rel="stylesheet" type="text/css" href="firebug.css">
</head>
<body>
<div id="toolbar" class="toolbar">
<a href="#" onclick="parent.console.clear()">Clear</a>
<span class="toolbarRight">
<a href="#" onclick="parent.console.close()">Close</a>
</span>
</div>
<div id="log"></div>
<input type="text" id="commandLine">
<script>parent.onFirebugReady(document);</script>
</body>
</html>

View file

@ -1,672 +0,0 @@
if (!window.console || !console.firebug) {
(function()
{
window.console =
{
log: function()
{
logFormatted(arguments, "");
},
debug: function()
{
logFormatted(arguments, "debug");
},
info: function()
{
logFormatted(arguments, "info");
},
warn: function()
{
logFormatted(arguments, "warning");
},
error: function()
{
logFormatted(arguments, "error");
},
assert: function(truth, message)
{
if (!truth)
{
var args = [];
for (var i = 1; i < arguments.length; ++i)
args.push(arguments[i]);
logFormatted(args.length ? args : ["Assertion Failure"], "error");
throw message ? message : "Assertion Failure";
}
},
dir: function(object)
{
var html = [];
var pairs = [];
for (var name in object)
{
try
{
pairs.push([name, object[name]]);
}
catch (exc)
{
}
}
pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });
html.push('<table>');
for (var i = 0; i < pairs.length; ++i)
{
var name = pairs[i][0], value = pairs[i][1];
html.push('<tr>',
'<td class="propertyNameCell"><span class="propertyName">',
escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');
appendObject(value, html);
html.push('</span></td></tr>');
}
html.push('</table>');
logRow(html, "dir");
},
dirxml: function(node)
{
var html = [];
appendNode(node, html);
logRow(html, "dirxml");
},
group: function()
{
logRow(arguments, "group", pushGroup);
},
groupEnd: function()
{
logRow(arguments, "", popGroup);
},
time: function(name)
{
timeMap[name] = (new Date()).getTime();
},
timeEnd: function(name)
{
if (name in timeMap)
{
var delta = (new Date()).getTime() - timeMap[name];
logFormatted([name+ ":", delta+"ms"]);
delete timeMap[name];
}
},
count: function()
{
this.warn(["count() not supported."]);
},
trace: function()
{
this.warn(["trace() not supported."]);
},
profile: function()
{
this.warn(["profile() not supported."]);
},
profileEnd: function()
{
},
clear: function()
{
consoleBody.innerHTML = "";
},
open: function()
{
toggleConsole(true);
},
close: function()
{
if (frameVisible)
toggleConsole();
}
};
// ********************************************************************************************
var consoleFrame = null;
var consoleBody = null;
var commandLine = null;
var frameVisible = false;
var messageQueue = [];
var groupStack = [];
var timeMap = {};
var clPrefix = ">>> ";
var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
var isOpera = navigator.userAgent.indexOf("Opera") != -1;
var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;
// ********************************************************************************************
function toggleConsole(forceOpen)
{
frameVisible = forceOpen || !frameVisible;
if (consoleFrame)
consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";
else
waitForBody();
}
function focusCommandLine()
{
toggleConsole(true);
if (commandLine)
commandLine.focus();
}
function waitForBody()
{
if (document.body)
createFrame();
else
setTimeout(waitForBody, 200);
}
function createFrame()
{
if (consoleFrame)
return;
window.onFirebugReady = function(doc)
{
window.onFirebugReady = null;
var toolbar = doc.getElementById("toolbar");
toolbar.onmousedown = onSplitterMouseDown;
commandLine = doc.getElementById("commandLine");
addEvent(commandLine, "keydown", onCommandLineKeyDown);
addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
consoleBody = doc.getElementById("log");
layout();
flush();
}
var baseURL = getFirebugURL();
consoleFrame = document.createElement("iframe");
consoleFrame.setAttribute("src", baseURL+"/firebug.html");
consoleFrame.setAttribute("frameBorder", "0");
consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");
consoleFrame.style.zIndex = "2147483583";
consoleFrame.style.position = document.all ? "absolute" : "fixed";
consoleFrame.style.width = "100%";
consoleFrame.style.left = "0";
consoleFrame.style.bottom = "0";
consoleFrame.style.height = "200px";
document.body.appendChild(consoleFrame);
}
function getFirebugURL()
{
var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; ++i)
{
if (scripts[i].src.indexOf("firebug.js") != -1)
{
var lastSlash = scripts[i].src.lastIndexOf("/");
return scripts[i].src.substr(0, lastSlash);
}
}
}
function evalCommandLine()
{
var text = commandLine.value;
commandLine.value = "";
logRow([clPrefix, text], "command");
var value;
try
{
value = eval(text);
}
catch (exc)
{
}
console.log(value);
}
function layout()
{
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");
var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);
consoleBody.style.top = toolbar.offsetHeight + "px";
consoleBody.style.height = height + "px";
commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";
}
function logRow(message, className, handler)
{
if (consoleBody)
writeMessage(message, className, handler);
else
{
messageQueue.push([message, className, handler]);
waitForBody();
}
}
function flush()
{
var queue = messageQueue;
messageQueue = [];
for (var i = 0; i < queue.length; ++i)
writeMessage(queue[i][0], queue[i][1], queue[i][2]);
}
function writeMessage(message, className, handler)
{
var isScrolledToBottom =
consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;
if (!handler)
handler = writeRow;
handler(message, className);
if (isScrolledToBottom)
consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;
}
function appendRow(row)
{
var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;
container.appendChild(row);
}
function writeRow(message, className)
{
var row = consoleBody.ownerDocument.createElement("div");
row.className = "logRow" + (className ? " logRow-"+className : "");
row.innerHTML = message.join("");
appendRow(row);
}
function pushGroup(message, className)
{
logFormatted(message, className);
var groupRow = consoleBody.ownerDocument.createElement("div");
groupRow.className = "logGroup";
var groupRowBox = consoleBody.ownerDocument.createElement("div");
groupRowBox.className = "logGroupBox";
groupRow.appendChild(groupRowBox);
appendRow(groupRowBox);
groupStack.push(groupRowBox);
}
function popGroup()
{
groupStack.pop();
}
// ********************************************************************************************
function logFormatted(objects, className)
{
var html = [];
var format = objects[0];
var objIndex = 0;
if (typeof(format) != "string")
{
format = "";
objIndex = -1;
}
var parts = parseFormat(format);
for (var i = 0; i < parts.length; ++i)
{
var part = parts[i];
if (part && typeof(part) == "object")
{
var object = objects[++objIndex];
part.appender(object, html);
}
else
appendText(part, html);
}
for (var i = objIndex+1; i < objects.length; ++i)
{
appendText(" ", html);
var object = objects[i];
if (typeof(object) == "string")
appendText(object, html);
else
appendObject(object, html);
}
logRow(html, className);
}
function parseFormat(format)
{
var parts = [];
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
for (var m = reg.exec(format); m; m = reg.exec(format))
{
var type = m[8] ? m[8] : m[5];
var appender = type in appenderMap ? appenderMap[type] : appendObject;
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
parts.push({appender: appender, precision: precision});
format = format.substr(m.index+m[0].length);
}
parts.push(format);
return parts;
}
function escapeHTML(value)
{
function replaceChars(ch)
{
switch (ch)
{
case "<":
return "&lt;";
case ">":
return "&gt;";
case "&":
return "&amp;";
case "'":
return "&#39;";
case '"':
return "&quot;";
}
return "?";
};
return String(value).replace(/[<>&"']/g, replaceChars);
}
function objectToString(object)
{
try
{
return object+"";
}
catch (exc)
{
return null;
}
}
// ********************************************************************************************
function appendText(object, html)
{
html.push(escapeHTML(objectToString(object)));
}
function appendNull(object, html)
{
html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');
}
function appendString(object, html)
{
html.push('<span class="objectBox-string">&quot;', escapeHTML(objectToString(object)),
'&quot;</span>');
}
function appendInteger(object, html)
{
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
}
function appendFloat(object, html)
{
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
}
function appendFunction(object, html)
{
var reName = /function ?(.*?)\(/;
var m = reName.exec(objectToString(object));
var name = m ? m[1] : "function";
html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');
}
function appendObject(object, html)
{
try
{
if (object == undefined)
appendNull("undefined", html);
else if (object == null)
appendNull("null", html);
else if (typeof object == "string")
appendString(object, html);
else if (typeof object == "number")
appendInteger(object, html);
else if (typeof object == "function")
appendFunction(object, html);
else if (object.nodeType == 1)
appendSelector(object, html);
else if (typeof object == "object")
appendObjectFormatted(object, html);
else
appendText(object, html);
}
catch (exc)
{
}
}
function appendObjectFormatted(object, html)
{
var text = objectToString(object);
var reObject = /\[object (.*?)\]/;
var m = reObject.exec(text);
html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')
}
function appendSelector(object, html)
{
html.push('<span class="objectBox-selector">');
html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');
if (object.id)
html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');
if (object.className)
html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');
html.push('</span>');
}
function appendNode(node, html)
{
if (node.nodeType == 1)
{
html.push(
'<div class="objectBox-element">',
'&lt;<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');
for (var i = 0; i < node.attributes.length; ++i)
{
var attr = node.attributes[i];
if (!attr.specified)
continue;
html.push('&nbsp;<span class="nodeName">', attr.nodeName.toLowerCase(),
'</span>=&quot;<span class="nodeValue">', escapeHTML(attr.nodeValue),
'</span>&quot;')
}
if (node.firstChild)
{
html.push('&gt;</div><div class="nodeChildren">');
for (var child = node.firstChild; child; child = child.nextSibling)
appendNode(child, html);
html.push('</div><div class="objectBox-element">&lt;/<span class="nodeTag">',
node.nodeName.toLowerCase(), '&gt;</span></div>');
}
else
html.push('/&gt;</div>');
}
else if (node.nodeType == 3)
{
html.push('<div class="nodeText">', escapeHTML(node.nodeValue),
'</div>');
}
}
// ********************************************************************************************
function addEvent(object, name, handler)
{
if (document.all)
object.attachEvent("on"+name, handler);
else
object.addEventListener(name, handler, false);
}
function removeEvent(object, name, handler)
{
if (document.all)
object.detachEvent("on"+name, handler);
else
object.removeEventListener(name, handler, false);
}
function cancelEvent(event)
{
if (document.all)
event.cancelBubble = true;
else
event.stopPropagation();
}
function onError(msg, href, lineNo)
{
var html = [];
var lastSlash = href.lastIndexOf("/");
var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);
html.push(
'<span class="errorMessage">', msg, '</span>',
'<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'
);
logRow(html, "error");
};
function onKeyDown(event)
{
if (event.keyCode == 123)
toggleConsole();
else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey
&& (event.metaKey || event.ctrlKey))
focusCommandLine();
else
return;
cancelEvent(event);
}
function onSplitterMouseDown(event)
{
if (isSafari || isOpera)
return;
addEvent(document, "mousemove", onSplitterMouseMove);
addEvent(document, "mouseup", onSplitterMouseUp);
for (var i = 0; i < frames.length; ++i)
{
addEvent(frames[i].document, "mousemove", onSplitterMouseMove);
addEvent(frames[i].document, "mouseup", onSplitterMouseUp);
}
}
function onSplitterMouseMove(event)
{
var win = document.all
? event.srcElement.ownerDocument.parentWindow
: event.target.ownerDocument.defaultView;
var clientY = event.clientY;
if (win != win.parent)
clientY += win.frameElement ? win.frameElement.offsetTop : 0;
var height = consoleFrame.offsetTop + consoleFrame.clientHeight;
var y = height - clientY;
consoleFrame.style.height = y + "px";
layout();
}
function onSplitterMouseUp(event)
{
removeEvent(document, "mousemove", onSplitterMouseMove);
removeEvent(document, "mouseup", onSplitterMouseUp);
for (var i = 0; i < frames.length; ++i)
{
removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);
removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);
}
}
function onCommandLineKeyDown(event)
{
if (event.keyCode == 13)
evalCommandLine();
else if (event.keyCode == 27)
commandLine.value = "";
}
window.onerror = onError;
addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
if (document.documentElement.getAttribute("debug") == "true")
toggleConsole(true);
})();
}

View file

@ -1,10 +0,0 @@
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

File diff suppressed because it is too large Load diff

View file

@ -1,119 +0,0 @@
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $
* $Rev: 4259 $
*
* Version: 1.2
*
* Requires: jQuery 1.2+
*/
(function($){
$.dimensions = {
version: '1.2'
};
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
// innerHeight and innerWidth
$.fn[ 'inner' + name ] = function() {
if (!this[0]) return;
var torl = name == 'Height' ? 'Top' : 'Left', // top or left
borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
};
// outerHeight and outerWidth
$.fn[ 'outer' + name ] = function(options) {
if (!this[0]) return;
var torl = name == 'Height' ? 'Top' : 'Left', // top or left
borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
options = $.extend({ margin: false }, options || {});
var val = this.is(':visible') ?
this[0]['offset' + name] :
num( this, name.toLowerCase() )
+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
};
});
// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
$.fn[ 'scroll' + name ] = function(val) {
if (!this[0]) return;
return val != undefined ?
// Set the scroll offset
this.each(function() {
this == window || this == document ?
window.scrollTo(
name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
name == 'Top' ? val : $(window)[ 'scrollTop' ]()
) :
this[ 'scroll' + name ] = val;
}) :
// Return the scroll offset
this[0] == window || this[0] == document ?
self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
$.boxModel && document.documentElement[ 'scroll' + name ] ||
document.body[ 'scroll' + name ] :
this[0][ 'scroll' + name ];
};
});
$.fn.extend({
position: function() {
var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
if (elem) {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
parentOffset = offsetParent.offset();
// Subtract element margins
offset.top -= num(elem, 'marginTop');
offset.left -= num(elem, 'marginLeft');
// Add offsetParent borders
parentOffset.top += num(offsetParent, 'borderTopWidth');
parentOffset.left += num(offsetParent, 'borderLeftWidth');
// Subtract the two offsets
results = {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
}
return results;
},
offsetParent: function() {
var offsetParent = this[0].offsetParent;
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
offsetParent = offsetParent.offsetParent;
return $(offsetParent);
}
});
function num(el, prop) {
return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};
})(jQuery);

View file

@ -1,424 +0,0 @@
/*
* jQuery Media Plugin for converting elements into rich media content.
*
* Examples and documentation at: http://malsup.com/jquery/media/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* @author: M. Alsup
* @version: 0.84 (12/01/2008)
* @requires jQuery v1.1.2 or later
* $Id: jquery.media.js 2460 2007-07-23 02:53:15Z malsup $
*
* Supported Media Players:
* - Flash
* - Quicktime
* - Real Player
* - Silverlight
* - Windows Media Player
* - iframe
*
* Supported Media Formats:
* Any types supported by the above players, such as:
* Video: asf, avi, flv, mov, mpg, mpeg, mp4, qt, smil, swf, wmv, 3g2, 3gp
* Audio: aif, aac, au, gsm, mid, midi, mov, mp3, m4a, snd, rm, wav, wma
* Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml
*
* Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac!
* Thanks to Dan Rossi for numerous bug reports and code bits!
*/
;(function($) {
/**
* Chainable method for converting elements into rich media.
*
* @param options
* @param callback fn invoked for each matched element before conversion
* @param callback fn invoked for each matched element after conversion
*/
$.fn.media = function(options, f1, f2) {
return this.each(function() {
if (typeof options == 'function') {
f2 = f1;
f1 = options;
options = {};
}
var o = getSettings(this, options);
// pre-conversion callback, passes original element and fully populated options
if (typeof f1 == 'function') f1(this, o);
var r = getTypesRegExp();
var m = r.exec(o.src) || [''];
o.type ? m[0] = o.type : m.shift();
for (var i=0; i < m.length; i++) {
fn = m[i].toLowerCase();
if (isDigit(fn[0])) fn = 'fn' + fn; // fns can't begin with numbers
if (!$.fn.media[fn])
continue; // unrecognized media type
// normalize autoplay settings
var player = $.fn.media[fn+'_player'];
if (!o.params) o.params = {};
if (player) {
var num = player.autoplayAttr == 'autostart';
o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false;
}
var $div = $.fn.media[fn](this, o);
$div.css('backgroundColor', o.bgColor).width(o.width);
// post-conversion callback, passes original element, new div element and fully populated options
if (typeof f2 == 'function') f2(this, $div[0], o, player.name);
break;
}
});
};
/**
* Non-chainable method for adding or changing file format / player mapping
* @name mapFormat
* @param String format File format extension (ie: mov, wav, mp3)
* @param String player Player name to use for the format (one of: flash, quicktime, realplayer, winmedia, silverlight or iframe
*/
$.fn.media.mapFormat = function(format, player) {
if (!format || !player || !$.fn.media.defaults.players[player]) return; // invalid
format = format.toLowerCase();
if (isDigit(format[0])) format = 'fn' + format;
$.fn.media[format] = $.fn.media[player];
$.fn.media[format+'_player'] = $.fn.media.defaults.players[player];
};
// global defautls; override as needed
$.fn.media.defaults = {
width: 400,
height: 400,
autoplay: 0, // normalized cross-player setting
bgColor: '#ffffff', // background color
params: { wmode: 'transparent'}, // added to object element as param elements; added to embed element as attrs
attrs: {}, // added to object and embed elements as attrs
flvKeyName: 'file', // key used for object src param (thanks to Andrea Ercolino)
flashvars: {}, // added to flash content as flashvars param/attr
flashVersion: '7', // required flash version
expressInstaller: null, // src for express installer
// default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
flvPlayer: 'mediaplayer.swf',
mp3Player: 'mediaplayer.swf',
// @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
silverlight: {
inplaceInstallPrompt: 'true', // display in-place install prompt?
isWindowless: 'true', // windowless mode (false for wrapping markup)
framerate: '24', // maximum framerate
version: '0.9', // Silverlight version
onError: null, // onError callback
onLoad: null, // onLoad callback
initParams: null, // object init params
userContext: null // callback arg passed to the load callback
}
};
// Media Players; think twice before overriding
$.fn.media.defaults.players = {
flash: {
name: 'flash',
types: 'flv,mp3,swf',
oAttrs: {
classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
type: 'application/x-oleobject',
codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion
},
eAttrs: {
type: 'application/x-shockwave-flash',
pluginspage: 'http://www.adobe.com/go/getflashplayer'
}
},
quicktime: {
name: 'quicktime',
types: 'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp',
oAttrs: {
classid: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'
},
eAttrs: {
pluginspage: 'http://www.apple.com/quicktime/download/'
}
},
realplayer: {
name: 'real',
types: 'ra,ram,rm,rpm,rv,smi,smil',
autoplayAttr: 'autostart',
oAttrs: {
classid: 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
},
eAttrs: {
type: 'audio/x-pn-realaudio-plugin',
pluginspage: 'http://www.real.com/player/'
}
},
winmedia: {
name: 'winmedia',
types: 'asf,avi,wma,wmv',
autoplayAttr: 'autostart',
oUrl: 'url',
oAttrs: {
classid: 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6',
type: 'application/x-oleobject'
},
eAttrs: {
type: $.browser.mozilla && isFirefoxWMPPluginInstalled() ? 'application/x-ms-wmp' : 'application/x-mplayer2',
pluginspage: 'http://www.microsoft.com/Windows/MediaPlayer/'
}
},
// special cases
iframe: {
name: 'iframe',
types: 'html,pdf'
},
silverlight: {
name: 'silverlight',
types: 'xaml'
}
};
//
// everything below here is private
//
// detection script for FF WMP plugin (http://www.therossman.org/experiments/wmp_play.html)
// (hat tip to Mark Ross for this script)
function isFirefoxWMPPluginInstalled() {
var plugs = navigator.plugins;
for (i = 0; i < plugs.length; i++) {
var plugin = plugs[i];
if (plugin['filename'] == 'np-mswmp.dll')
return true;
}
return false;
}
var counter = 1;
for (var player in $.fn.media.defaults.players) {
var types = $.fn.media.defaults.players[player].types;
$.each(types.split(','), function(i,o) {
if (isDigit(o[0])) o = 'fn' + o;
$.fn.media[o] = $.fn.media[player] = getGenerator(player);
$.fn.media[o+'_player'] = $.fn.media.defaults.players[player];
});
};
function getTypesRegExp() {
var types = '';
for (var player in $.fn.media.defaults.players) {
if (types.length) types += ',';
types += $.fn.media.defaults.players[player].types;
};
return new RegExp('\\.(' + types.replace(/,/g,'|') + ')$\\b');
};
function getGenerator(player) {
return function(el, options) {
return generate(el, options, player);
};
};
function isDigit(c) {
return '0123456789'.indexOf(c) > -1;
};
// flatten all possible options: global defaults, meta, option obj
function getSettings(el, options) {
options = options || {};
var $el = $(el);
var cls = el.className || '';
// support metadata plugin (v1.0 and v2.0)
var meta = $.metadata ? $el.metadata() : $.meta ? $el.data() : {};
meta = meta || {};
var w = meta.width || parseInt(((cls.match(/w:(\d+)/)||[])[1]||0));
var h = meta.height || parseInt(((cls.match(/h:(\d+)/)||[])[1]||0));
if (w) meta.width = w;
if (h) meta.height = h;
if (cls) meta.cls = cls;
var a = $.fn.media.defaults;
var b = options;
var c = meta;
var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor } };
var opts = $.extend({}, a, b, c);
$.each(['attrs','params','flashvars','silverlight'], function(i,o) {
opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {});
});
if (typeof opts.caption == 'undefined') opts.caption = $el.text();
// make sure we have a source!
opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown';
return opts;
};
//
// Flash Player
//
// generate flash using SWFObject library if possible
$.fn.media.swf = function(el, opts) {
if (!window.SWFObject && !window.swfobject) {
// roll our own
if (opts.flashvars) {
var a = [];
for (var f in opts.flashvars)
a.push(f + '=' + opts.flashvars[f]);
if (!opts.params) opts.params = {};
opts.params.flashvars = a.join('&');
}
return generate(el, opts, 'flash');
}
var id = el.id ? (' id="'+el.id+'"') : '';
var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
var $div = $('<div' + id + cls + '>');
// swfobject v2+
if (window.swfobject) {
$(el).after($div).appendTo($div);
if (!el.id) el.id = 'movie_player_' + counter++;
// replace el with swfobject content
swfobject.embedSWF(opts.src, el.id, opts.width, opts.height, opts.flashVersion,
opts.expressInstaller, opts.flashvars, opts.params, opts.attrs);
}
// swfobject < v2
else {
$(el).after($div).remove();
var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor);
if (opts.expressInstaller) so.useExpressInstall(opts.expressInstaller);
for (var p in opts.params)
if (p != 'bgColor') so.addParam(p, opts.params[p]);
for (var f in opts.flashvars)
so.addVariable(f, opts.flashvars[f]);
so.write($div[0]);
}
if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
return $div;
};
// map flv and mp3 files to the swf player by default
$.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
var src = opts.src;
var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer;
var key = opts.flvKeyName;
src = encodeURIComponent(src);
opts.src = player;
opts.src = opts.src + '?'+key+'=' + (src);
var srcObj = {};
srcObj[key] = src;
opts.flashvars = $.extend({}, srcObj, opts.flashvars );
return $.fn.media.swf(el, opts);
};
//
// Silverlight
//
$.fn.media.xaml = function(el, opts) {
if (!window.Sys || !window.Sys.Silverlight) {
if ($.fn.media.xaml.warning) return;
$.fn.media.xaml.warning = 1;
alert('You must include the Silverlight.js script.');
return;
}
var props = {
width: opts.width,
height: opts.height,
background: opts.bgColor,
inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt,
isWindowless: opts.silverlight.isWindowless,
framerate: opts.silverlight.framerate,
version: opts.silverlight.version
};
var events = {
onError: opts.silverlight.onError,
onLoad: opts.silverlight.onLoad
};
var id1 = el.id ? (' id="'+el.id+'"') : '';
var id2 = opts.id || 'AG' + counter++;
// convert element to div
var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
var $div = $('<div' + id1 + cls + '>');
$(el).after($div).remove();
Sys.Silverlight.createObjectEx({
source: opts.src,
initParams: opts.silverlight.initParams,
userContext: opts.silverlight.userContext,
id: id2,
parentElement: $div[0],
properties: props,
events: events
});
if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
return $div;
};
//
// generate object/embed markup
//
function generate(el, opts, player) {
var $el = $(el);
var o = $.fn.media.defaults.players[player];
if (player == 'iframe') {
var o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >');
o.attr('src', opts.src);
o.css('backgroundColor', o.bgColor);
}
else if ($.browser.msie) {
var a = ['<object width="' + opts.width + '" height="' + opts.height + '" '];
for (var key in opts.attrs)
a.push(key + '="'+opts.attrs[key]+'" ');
for (var key in o.oAttrs || {}) {
var v = o.oAttrs[key];
if (key == 'codebase' && window.location.protocol == 'https')
v = v.replace('http','https');
a.push(key + '="'+v+'" ');
}
a.push('></ob'+'ject'+'>');
var p = ['<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">'];
for (var key in opts.params)
p.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
var o = document.createElement(a.join(''));
for (var i=0; i < p.length; i++)
o.appendChild(document.createElement(p[i]));
}
else {
var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"'];
if (opts.src) a.push(' src="' + opts.src + '" ');
for (var key in opts.attrs)
a.push(key + '="'+opts.attrs[key]+'" ');
for (var key in o.eAttrs || {})
a.push(key + '="'+o.eAttrs[key]+'" ');
for (var key in opts.params)
if (key != 'wmode') // FF3/Quicktime borks on wmode
a.push(key + '="'+opts.params[key]+'" ');
a.push('></em'+'bed'+'>');
}
// convert element to div
var id = el.id ? (' id="'+el.id+'"') : '';
var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
var $div = $('<div' + id + cls + '>');
$el.after($div).remove();
($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
return $div;
};
})(jQuery);

View file

@ -1,156 +0,0 @@
/*
* jQuery JSON Plugin
* version: 1.0 (2008-04-17)
*
* This document is licensed as free software under the terms of the
* MIT License: http://www.opensource.org/licenses/mit-license.php
*
* Brantley Harris technically wrote this plugin, but it is based somewhat
* on the JSON.org website's http://www.json.org/json2.js, which proclaims:
* "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that
* I uphold. I really just cleaned it up.
*
* It is also based heavily on MochiKit's serializeJSON, which is
* copywrited 2005 by Bob Ippolito.
*/
(function($) {
function toIntegersAtLease(n)
// Format integers to have at least two digits.
{
return n < 10 ? '0' + n : n;
}
Date.prototype.toJSON = function(date)
// Yes, it polutes the Date namespace, but we'll allow it here, as
// it's damned usefull.
{
return this.getUTCFullYear() + '-' +
toIntegersAtLease(this.getUTCMonth()) + '-' +
toIntegersAtLease(this.getUTCDate());
};
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
var meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
$.quoteString = function(string)
// Places quotes around a string, inteligently.
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
{
if (escapeable.test(string))
{
return '"' + string.replace(escapeable, function (a)
{
var c = meta[a];
if (typeof c === 'string') {
return c;
}
c = a.charCodeAt();
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
}) + '"';
}
return '"' + string + '"';
};
$.toJSON = function(o, compact)
{
var type = typeof(o);
if (type == "undefined")
return "undefined";
else if (type == "number" || type == "boolean")
return o + "";
else if (o === null)
return "null";
// Is it a string?
if (type == "string")
{
return $.quoteString(o);
}
// Does it have a .toJSON function?
if (type == "object" && typeof o.toJSON == "function")
return o.toJSON(compact);
// Is it an array?
if (type != "function" && typeof(o.length) == "number")
{
var ret = [];
for (var i = 0; i < o.length; i++) {
ret.push( $.toJSON(o[i], compact) );
}
if (compact)
return "[" + ret.join(",") + "]";
else
return "[" + ret.join(", ") + "]";
}
// If it's a function, we have to warn somebody!
if (type == "function") {
throw new TypeError("Unable to convert object of type 'function' to json.");
}
// It's probably an object, then.
var ret = [];
for (var k in o) {
var name;
type = typeof(k);
if (type == "number")
name = '"' + k + '"';
else if (type == "string")
name = $.quoteString(k);
else
continue; //skip non-string or number keys
var val = $.toJSON(o[k], compact);
if (typeof(val) != "string") {
// skip non-serializable values
continue;
}
if (compact)
ret.push(name + ":" + val);
else
ret.push(name + ": " + val);
}
return "{" + ret.join(", ") + "}";
};
$.compactJSON = function(o)
{
return $.toJSON(o, true);
};
$.evalJSON = function(src)
// Evals JSON that we know to be safe.
{
return eval("(" + src + ")");
};
$.secureEvalJSON = function(src)
// Evals JSON in a way that is *more* secure.
{
var filtered = src;
filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
if (/^[\],:{}\s]*$/.test(filtered))
return eval("(" + src + ")");
else
throw new SyntaxError("Error parsing JSON, source is not valid.");
};
})(jQuery);

View file

@ -1,121 +0,0 @@
/*
* Metadata - jQuery plugin for parsing metadata from elements
*
* Copyright (c) 2006 John Resig, Yehuda Katz, J<EFBFBD>örn Zaefferer, Paul McLanahan
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
*
*/
/**
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
* in the JSON will become a property of the element itself.
*
* There are three supported types of metadata storage:
*
* attr: Inside an attribute. The name parameter indicates *which* attribute.
*
* class: Inside the class attribute, wrapped in curly braces: { }
*
* elem: Inside a child element (e.g. a script tag). The
* name parameter indicates *which* element.
*
* The metadata for an element is loaded the first time the element is accessed via jQuery.
*
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
*
* @name $.metadata.setType
*
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("class")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from the class attribute
*
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("attr", "data")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a "data" attribute
*
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
* @before $.metadata.setType("elem", "script")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a nested script element
*
* @param String type The encoding type
* @param String name The name of the attribute to be used to get metadata (optional)
* @cat Plugins/Metadata
* @descr Sets the type of encoding to be used when loading metadata for the first time
* @type undefined
* @see metadata()
*/
(function($) {
$.extend({
metadata : {
defaults : {
type: 'class',
name: 'metadata',
cre: /({.*})/,
single: 'metadata'
},
setType: function( type, name ){
this.defaults.type = type;
this.defaults.name = name;
},
get: function( elem, opts ){
var settings = $.extend({},this.defaults,opts);
// check for empty string in single property
if ( !settings.single.length ) settings.single = 'metadata';
var data = $.data(elem, settings.single);
// returned cached data if it already exists
if ( data ) return data;
data = "{}";
if ( settings.type == "class" ) {
var m = settings.cre.exec( elem.className );
if ( m )
data = m[1];
} else if ( settings.type == "elem" ) {
if( !elem.getElementsByTagName ) return;
var e = elem.getElementsByTagName(settings.name);
if ( e.length )
data = $.trim(e[0].innerHTML);
} else if ( elem.getAttribute != undefined ) {
var attr = elem.getAttribute( settings.name );
if ( attr )
data = attr;
}
if ( data.indexOf( '{' ) <0 )
data = "{" + data + "}";
data = eval("(" + data + ")");
$.data( elem, settings.single, data );
return data;
}
}
});
/**
* Returns the metadata object for the first member of the jQuery object.
*
* @name metadata
* @descr Returns element's metadata object
* @param Object opts An object contianing settings to override the defaults
* @type jQuery
* @cat Plugins/Metadata
*/
$.fn.metadata = function( opts ){
return $.metadata.get( this[0], opts );
};
})(jQuery);

View file

@ -1,182 +0,0 @@
/* Copyright (c) 2005 Scott S. McCoy
* This was originally a non-object oriented interface
* Function printf(format_string,arguments...)
* Javascript emulation of the C printf function (modifiers and argument types
* "p" and "n" are not supported due to language restrictions)
*
* Copyright 2003 K&L Productions. All rights reserved
* http://www.klproductions.com
*
* Terms of use: This function can be used free of charge IF this header is not
* modified and remains with the function code.
*
* Legal: Use this code at your own risk. K&L Productions assumes NO resposibility
* for anything.
********************************************************************************/
String.prototype.sprintf = function () {
var fstring = this.toString();
var pad = function(str,ch,len) { var ps='';
for(var i=0; i<Math.abs(len); i++) {
ps+=ch;
}
return len>0?str+ps:ps+str;
};
var processFlags = function(flags,width,rs,arg) {
var pn = function(flags,arg,rs) {
if(arg>=0) {
if(flags.indexOf(' ')>=0) {
rs = ' ' + rs;
} else if(flags.indexOf('+')>=0) {
rs = '+' + rs;
}
} else {
rs = '-' + rs;
}
return rs;
};
var iWidth = parseInt(width,10);
if(width.charAt(0) == '0') {
var ec=0;
if(flags.indexOf(' ')>=0 || flags.indexOf('+')>=0) {
ec++;
}
if(rs.length<(iWidth-ec)) {
rs = pad(rs,'0',rs.length-(iWidth-ec));
}
return pn(flags,arg,rs);
}
rs = pn(flags,arg,rs);
if(rs.length<iWidth) {
if(flags.indexOf('-')<0) {
rs = pad(rs,' ',rs.length-iWidth);
} else {
rs = pad(rs,' ',iWidth - rs.length);
}
}
return rs;
};
var converters = [];
converters.c = function(flags,width,precision,arg) {
if (typeof(arg) == 'number') {
return String.fromCharCode(arg);
} else if (typeof(arg) == 'string') {
return arg.charAt(0);
} else {
return '';
}
};
converters.d = function(flags,width,precision,arg) {
return converters.i(flags,width,precision,arg);
};
converters.u = function(flags,width,precision,arg) {
return converters.i(flags,width,precision,Math.abs(arg));
};
converters.i = function(flags,width,precision,arg) {
var iPrecision=parseInt(precision, 10);
var rs = ((Math.abs(arg)).toString().split('.'))[0];
if(rs.length<iPrecision) {
rs=pad(rs,' ',iPrecision - rs.length);
}
return processFlags(flags,width,rs,arg);
};
converters.E = function(flags,width,precision,arg) {
return (converters.e(flags,width,precision,arg)).toUpperCase();
};
converters.e = function(flags,width,precision,arg) {
iPrecision = parseInt(precision, 10);
if(isNaN(iPrecision)) {
iPrecision = 6;
}
rs = (Math.abs(arg)).toExponential(iPrecision);
if(rs.indexOf('.')<0 && flags.indexOf('#')>=0) {
rs = rs.replace(/^(.*)(e.*)$/,'$1.$2');
}
return processFlags(flags,width,rs,arg);
};
converters.f = function(flags,width,precision,arg) {
iPrecision = parseInt(precision, 10);
if(isNaN(iPrecision)) {
iPrecision = 6;
}
rs = (Math.abs(arg)).toFixed(iPrecision);
if(rs.indexOf('.')<0 && flags.indexOf('#')>=0) {
rs = rs + '.';
}
return processFlags(flags,width,rs,arg);
};
converters.G = function(flags,width,precision,arg) {
return (converters.g(flags,width,precision,arg)).toUpperCase();
};
converters.g = function(flags,width,precision,arg) {
iPrecision = parseInt(precision, 10);
absArg = Math.abs(arg);
rse = absArg.toExponential();
rsf = absArg.toFixed(6);
if(!isNaN(iPrecision)) {
rsep = absArg.toExponential(iPrecision);
rse = rsep.length < rse.length ? rsep : rse;
rsfp = absArg.toFixed(iPrecision);
rsf = rsfp.length < rsf.length ? rsfp : rsf;
}
if(rse.indexOf('.')<0 && flags.indexOf('#')>=0) {
rse = rse.replace(/^(.*)(e.*)$/,'$1.$2');
}
if(rsf.indexOf('.')<0 && flags.indexOf('#')>=0) {
rsf = rsf + '.';
}
rs = rse.length<rsf.length ? rse : rsf;
return processFlags(flags,width,rs,arg);
};
converters.o = function(flags,width,precision,arg) {
var iPrecision=parseInt(precision, 10);
var rs = Math.round(Math.abs(arg)).toString(8);
if(rs.length<iPrecision) {
rs=pad(rs,' ',iPrecision - rs.length);
}
if(flags.indexOf('#')>=0) {
rs='0'+rs;
}
return processFlags(flags,width,rs,arg);
};
converters.X = function(flags,width,precision,arg) {
return (converters.x(flags,width,precision,arg)).toUpperCase();
};
converters.x = function(flags,width,precision,arg) {
var iPrecision=parseInt(precision, 10);
arg = Math.abs(arg);
var rs = Math.round(arg).toString(16);
if(rs.length<iPrecision) {
rs=pad(rs,' ',iPrecision - rs.length);
}
if(flags.indexOf('#')>=0) {
rs='0x'+rs;
}
return processFlags(flags,width,rs,arg);
};
converters.s = function(flags,width,precision,arg) {
var iPrecision=parseInt(precision, 10);
var rs = arg;
if(rs.length > iPrecision) {
rs = rs.substring(0,iPrecision);
}
return processFlags(flags,width,rs,0);
};
farr = fstring.split('%');
retstr = farr[0];
fpRE = /^([-+ #]*)(?:(\d*)\$|)(\d*)\.?(\d*)([cdieEfFgGosuxX])(.*)$/;
for(var i = 1; i<farr.length; i++) {
fps=fpRE.exec(farr[i]);
if(!fps) {
continue;
}
var my_i = fps[2] ? fps[2] : i;
if(arguments[my_i-1]) {
retstr+=converters[fps[5]](fps[1],fps[3],fps[4],arguments[my_i-1]);
}
retstr += fps[6];
}
return retstr;
};