Migrate old externs 7/x

This commit is contained in:
2026-06-16 08:33:04 +08:00
parent 3bc6957677
commit c2fb5b205a
51 changed files with 390 additions and 317 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
var Cycle = __import( "System.Cycle" );
/** @type {System.utils} */
var utils = __import( "System.utils" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {System.Debug} */
var debug = __import( "System.Debug" );
@@ -13,7 +13,7 @@
var MessageBox = __import( "Components.MessageBox" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {function(...?): Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
@@ -11,15 +11,15 @@
var IKey = __import( "System.utils.IKey" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {typeof Components.MessageBox} */
var MessageBox = __import( "Components.MessageBox" );
/** @type {Components.Mouse.ContextMenu} */
/** @type {typeof Components.Mouse.ContextMenu} */
var ContextMenu = __import( "Components.Mouse.ContextMenu" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {function(...?): Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
@@ -5,7 +5,7 @@
var Dand = __import( "Dandelion" );
/** @type {function(...?): Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {System.Cycle} */
var Cycle = __import( "System.Cycle" );
@@ -515,7 +515,7 @@
}
};
IDOMObject( document ).addEventListener( "KeyDown", KeyHandler( document, BackQuoteBinding ), false );
new IDOMObject( document ).addEventListener( "KeyDown", KeyHandler( document, BackQuoteBinding ), false );
};
ns[ NS_EXPORT ]( EX_CLASS, "SmartInput", MasterInput );
+4 -4
View File
@@ -5,15 +5,15 @@
var Cycle = __import( "System.Cycle" );
/** @type {System.Debug} */
var debug = __import( "System.Debug" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {Components.Mouse.ContextMenu} */
/** @type {typeof Components.Mouse.ContextMenu} */
var ContextMenu = __import( "Components.Mouse.ContextMenu" );
/** @type {typeof Components.MessageBox} */
var MessageBox = __import( "Components.MessageBox" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {Astro.Blog.Config} */
var Conf = __import( "Astro.Blog.Config" );
@@ -149,7 +149,7 @@
fileList.style.paddingTop = String(p_status.clientHeight) + "px";
var docDom = IDOMObject( document );
var docDom = new IDOMObject( document );
// Drag/drop handlers
docDom.addEventListener( "DragOver", function ( e )
{
@@ -145,10 +145,10 @@
);
// ad handlers to handles size change event
IDOMElement(s).element.addEventListener("Change", selectionChanged.bind({size: "small"}));
IDOMElement(m).element.addEventListener("Change", selectionChanged.bind({size: "medium"}));
IDOMElement(l).element.addEventListener("Change", selectionChanged.bind({size: "large"}));
IDOMElement(o).element.addEventListener("Change", selectionChanged.bind({size: "original"}));
IDOMElement(s).addEventListener("Change", selectionChanged.bind({size: "small"}));
IDOMElement(m).addEventListener("Change", selectionChanged.bind({size: "medium"}));
IDOMElement(l).addEventListener("Change", selectionChanged.bind({size: "large"}));
IDOMElement(o).addEventListener("Change", selectionChanged.bind({size: "original"}));
var hasValue = _stage.getDAttribute( "size" );
if( hasValue )
@@ -13,7 +13,7 @@
var Perf = __import( "System.utils.Perf" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {typeof System.utils.IKey} */
var IKey = __import( "System.utils.IKey" );
@@ -21,7 +21,7 @@
var Loader = __import( "System.Net.ClassLoader" );
/** @type {typeof Components.MessageBox} */
var MessageBox = __import( "Components.MessageBox" );
/** @type {Components.Mouse.ContextMenu} */
/** @type {typeof Components.Mouse.ContextMenu} */
var ContextMenu = __import( "Components.Mouse.ContextMenu" );
/** @type {Astro.Blog.Config} */
var Config = __import( "Astro.Blog.Config" );
+1 -1
View File
@@ -3,7 +3,7 @@
/** @type {System.Cycle} */
var Cycle = __import( "System.Cycle" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
+14 -13
View File
@@ -9,7 +9,7 @@
var Trigger = __import( "System.Cycle.Trigger" );
/** @type {typeof System.utils.IKey} */
var IKey = __import( "System.utils.IKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
@@ -76,7 +76,7 @@
, cHeight = 0
, elmH = "1.2em"
, cp = Dand.id( "c_input_panel" )
, cp = /** @type {HTMLElement} */ (Dand.id( "c_input_panel" ))
, contentField = Dand.id( "content_field" )
, nameField = Dand.id( "name_field" )
, c_body = Dand.id( "comment_body" )
@@ -274,9 +274,9 @@
Trigger.transition(cp.style, "", function()
{
cp.style.padding = "0";
cp.style.height = "0";
});
this.style.padding = "0";
this.style.height = "0";
}.bind(cp));
// After transition finished, remove input panel
Cycle.delay(function()
@@ -432,11 +432,12 @@
// Close Input panel
closeInputPanel( null );
var el;
// Remove false_fields
for(var i = 0, l = fields.length; i < l; i ++)
{
i = Dand.id("false_" + fields[i]);
i.parentNode.removeChild(i);
el = /** @type {HTMLElement} */ (Dand.id("false_" + fields[i]));
el.parentNode.removeChild(el);
}
c_stack.style.opacity = 0;
cp.parentNode.insertBefore( c_stack, cp );
@@ -444,12 +445,12 @@
c_stack.style.marginTop = ( -c_stack.clientHeight ) + "px";
// if nocomment notice exist, remove it
if( i = Dand.id("nocomment") )
if( el = /** @type {HTMLElement} */ (Dand.id("nocomment")) )
{
i.style.transition = "all 0s";
i.style.width = "658px";
i.style.height = "22px";
i.style.overflow = "hidden";
el.style.transition = "all 0s";
el.style.width = "658px";
el.style.height = "22px";
el.style.overflow = "hidden";
// transition
Cycle.next(function()
{
@@ -458,7 +459,7 @@
this.style.width = "0";
this.style.padding = "0";
this.style.height = "0";
}.bind(i));
}.bind(el));
// Pending remove
Trigger.height(i, 0, function(){ this.parentNode.removeChild(this); }.bind(i));
}
@@ -11,13 +11,13 @@
var IKey = __import( "System.utils.IKey" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {typeof Components.MessageBox} */
var MessageBox = __import( "Components.MessageBox" );
/** @type {Components.Mouse.ContextMenu} */
/** @type {typeof Components.Mouse.ContextMenu} */
var ContextMenu = __import( "Components.Mouse.ContextMenu" );
/** @type {Astro.Bootstrap} */
var Bootstrap = __import( "Astro.Bootstrap" );
@@ -32,7 +32,7 @@
var init = function ()
{
var stage = Dand.id( "notifications" );
var nt_body = Dand.id( "nt_body" );
var nt_body = /** @type HTMLElement */ (Dand.id( "nt_body" ));
var bodyStyle = nt_body.style;
/** @type {_AstConf_.Notification} */
@@ -156,10 +156,12 @@
var items = [], menuShow = false;
var hasNotis = 0 < e.data.length;
/** @type {_AstJson_.AJaxGetNotis} */
var data;
for( var n in e.data )
{
/** @type {_AstJson_.AJaxGetNotis} */
var data = e.data[n];
data = e.data[n];
// Create items
items[ items.length ] = new IKey(
data.mesg
@@ -173,7 +175,7 @@
Dand.glass( "nt_icon_settings", true )[0].addEventListener( "Click", popupSettings );
contextMenu = new ContextMenu(
Dand.id( "nt_open_menu" )
/** @type HTMLElement */ (Dand.id( "nt_open_menu" ))
, items
, "LMB"
, nt_body
@@ -220,8 +222,7 @@
for( n in e.data )
{
/** @type {_AstJson_.AJaxGetNotis} */
var data = e.data[n];
data = e.data[n];
var li = contextMenu.getItemByKey( "m_" + data.id ).stage;
li.appendChild(
@@ -12,9 +12,10 @@
/** @type {Astro.Blog.Config} */
var Conf = __import( "Astro.Blog.Config" );
/** @type {_AstConf_.CommentToggle} */
/** @type {Array<string|Object<string,*>>} */
var settings = Conf.get( "CommentToggle" );
/** @constructor */
var CommentToggle = function( id, processor, object )
{
ToggleButton.call( this, id, processor, object );
@@ -24,7 +25,7 @@
var init = function()
{
for( var i in settings )
for( var i = 0, l = settings.length; i < l; i ++ )
{
var button = settings[i];
new CommentToggle( button[0], button[1], button[2] );
@@ -7,13 +7,14 @@
var IDOMElement = __import( "Dandelion.IDOMElement" );
/** @type {Astro.Bootstrap} */
var Bootstrap = __import( "Astro.Bootstrap" );
/** @type {Astro.Blog} */
/** @type {Astro.Blog.Config} */
var config = __import( "Astro.Blog.Config" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
var postData = __import( "System.Net.postData" );
/** @constructor */
var ToggleButton = function ( elem, processor, obj )
{
var stage = Dand.id( elem, true );
@@ -52,7 +53,7 @@
var init = function()
{
var toggles = config.get( "ToggleButtons" );
for( var i in toggles )
for( var i = 0, l = toggles.length; i < l; i ++ )
{
new ToggleButton( toggles[ i ][0], toggles[ i ][1], toggles[ i ][2] );
}
+2 -4
View File
@@ -39,10 +39,8 @@
var getData = __import( "System.Net.getData" );
var mobile = __import( "System.Global.MOBILE" );
/** @const {number} */
var ELEMENT_NODE = Node.ELEMENT_NODE;
/** @const {number} */
var COMMENT_NODE = Node.COMMENT_NODE;
var ELEMENT_NODE = 1;
var COMMENT_NODE = 8;
var header;
+2 -2
View File
@@ -5,7 +5,7 @@
var Cycle = __import( "System.Cycle" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
var Parallax = {
@@ -111,7 +111,7 @@
EnterFrame( animate );
};
IDOMObject( eDispatcher ).addEventListener( "Scroll", dispatchAnima );
new IDOMObject( eDispatcher ).addEventListener( "Scroll", dispatchAnima );
};
ns[ NS_EXPORT ]( EX_FUNC, "cssSlide", cssSlide );
@@ -11,7 +11,7 @@
var DataKey = __import( "System.utils.DataKey" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {function(...?): Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
@@ -3,7 +3,7 @@
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {Dandelion.Window} */
var wsupp = __import( "Dandelion.Window" );
+3 -3
View File
@@ -5,9 +5,9 @@
var Trigger = __import( "System.Cycle.Trigger" );
/** @type {typeof Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
// __import( "Dandelion.CSSAnimations" ); CSS_RESERVATION
@@ -15,7 +15,7 @@
var MessageBox = function ( title, content, yes, no, handler )
{
var _self = this;
var doc = IDOMObject( document );
var doc = new IDOMObject( document );
var _yes = Dand.wrap(
"span", null
+1 -1
View File
@@ -83,7 +83,7 @@
if( cCallback ) cCallback();
debug.Info( "[Clipboard] Text copied" );
document.onmousemove = null;
document["onmousemove"] = null;
};
var onMouseOver = function ( callback )
+9 -9
View File
@@ -8,7 +8,7 @@
var IKey = __import( "System.utils.IKey" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {System.Cycle} */
var Cycle = __import( "System.Cycle" );
@@ -34,7 +34,7 @@
document.body.appendChild( Dand.wrap( null, "contextMenus", "compx" ) )
)
, targetParent
, temp, i, j
, temp, j
, _items = []
, getFuncOverride = function(prop) { return utils.objGetProp( overrides, prop, "Function" ); }
@@ -44,7 +44,7 @@
{
element = Dand.bubbleUp( element, isMenuItem );
for (i in _items)
for (var i = 0, l = _items.length; i < l; i ++)
{
// match attributes
if(element == _items[i].stage)
@@ -61,8 +61,8 @@
if( e === document ) return false;
return IDOMElement(e).getDAttribute("menuItem");
}
, addMenuIdentifier = function(dataKey)
, addMenuIdentifier = /** @param {System.utils.DataKey=} dataKey */ function(dataKey)
{
var d = new DataKey("menuItem", 1);
return dataKey ? [dataKey, d] : d;
@@ -88,7 +88,7 @@
, _chainHide = getFuncOverride("chainHide")
, _chainShow = getFuncOverride("chainShow")
, _hideMenu = getFuncOverride("hideMenu")
, hideMenu
// , hideMenu defined later
, _showMenu = getFuncOverride("showMenu")
, showMenu = function (event)
@@ -279,7 +279,7 @@
var itemroot = Dand.wrapna("ul", addMenuIdentifier())
, j = obj.items;
for (var i in j)
for (var i = 0, l = j.length; i < l; i ++)
{
if(!(j[i] instanceof IKey))
@@ -321,7 +321,7 @@
return stage;
};
for ( i in items )
for (var i = 0, l = items.length; i < l; i ++)
{
if ( ( j = items[i] ) )
{
@@ -403,7 +403,7 @@
this.getItemByKey = function (key)
{
for (i in _items)
for (var i = 0, l = _items.length; i < l; i ++)
{
// match attributes
if(IDOMElement(_items[i].stage).getDAttribute("id") == key)
+1 -1
View File
@@ -3,7 +3,7 @@
/** @type {System.Debug} */
var debug = __import( "System.Debug" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {Components.Vim.ActionEvent} */
var ActionEvent = __import( "Components.Vim.ActionEvent" );
+1 -1
View File
@@ -5,7 +5,7 @@
var IDOMElement = __import( "Dandelion.IDOMElement" );
/** @type {typeof System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {System.Cycle} */
var Cycle = __import( "System.Cycle" );
@@ -1,7 +1,7 @@
(function(){
var ns = __namespace( "Dandelion.CSSAnimations" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @type {System.Cycle.Trigger} */
var Trigger = __import( "System.Cycle.Trigger" );
+28 -39
View File
@@ -9,28 +9,17 @@
var wrap = ns[ NS_INVOKE ]( "wrap" );
var IDOMObject = ns[ NS_INVOKE ]( "IDOMObject" );
/** @type {function(...?): Dandelion.IDOMElement} */
var IDOMElement;
/** @type {typeof Dandelion.IDOMElement} */
var _IDOMElement;
IDOMElement = function ( element, sw )
_IDOMElement = function ( element, sw )
{
if ( element instanceof IDOMElement ) return element;
if ( element instanceof _IDOMElement ) return element;
if ( sw )
{
IDOMObject.call( this, element, true );
this["getDAttribute"] = this.getDAttribute.bind( element );
this["loot"] = this.loot.bind( element );
this["foreach"] = this.foreach.bind(element);
this["reverseChild"] = this.reverseChild.bind( element );
this["clear"] = this.clear.bind( element );
this["first"] = this.first.bind( element );
this["last"] = this.last.bind( element );
this["contains"] = this.contains.bind( element );
// Org values
this["style"] = element.style;
this["hasAttribute"] = function ( key ) { this.hasAttribute( key ); }.bind( element );
@@ -42,11 +31,11 @@
}
else if ( element && element[ "nodeType" ] != undefined && element.nodeType == 1 )
{
return new IDOMElement( element, true );
return new _IDOMElement( element, true );
}
else if( element === undefined )
{
return new IDOMElement( wrap(), true );
return new _IDOMElement( wrap(), true );
}
else
{
@@ -55,9 +44,9 @@
return this;
};
__extends( IDOMElement, IDOMObject );
__extends( _IDOMElement, IDOMObject );
IDOMElement.prototype.setAttribute = function( k, v )
_IDOMElement.prototype.setAttribute = function( k, v )
{
if( k instanceof IKey )
{
@@ -65,7 +54,7 @@
}
else if( k instanceof Array )
{
for ( var i in k )
for ( var i = 0, l = k.length; i < l; i ++ )
{
if ( k[i] instanceof IKey )
{
@@ -79,31 +68,31 @@
}
};
IDOMElement.prototype.loot = function ( element )
_IDOMElement.prototype.loot = function ( element )
{
var _nodes = element.childNodes;
while(_nodes.length)
{
this.appendChild( element.removeChild( _nodes[0] ) );
this.element.appendChild( element.removeChild( _nodes[0] ) );
}
};
IDOMElement.prototype.clear = function ()
_IDOMElement.prototype.clear = function ()
{
var _nodes = this.childNodes;
var _nodes = this.element.childNodes;
while( _nodes.length )
this.removeChild( _nodes[0] );
this.element.removeChild( _nodes[0] );
};
IDOMElement.prototype.getDAttribute = function(name)
_IDOMElement.prototype.getDAttribute = function(name)
{
var i = this.getAttribute("data-" + name);
var i = this.element.getAttribute("data-" + name);
return i && decodeURIComponent(i);
};
IDOMElement.prototype.foreach = function(type, callback)
_IDOMElement.prototype.foreach = function(type, callback)
{
var c = Array.apply( [], this.childNodes ), l = c.length;
var c = Array.apply( [], this.element.childNodes ), l = c.length;
for(var i = 0; i < l; i ++)
{
if (c[i].nodeType == type)
@@ -126,9 +115,9 @@
return matchNone;
};
IDOMElement.prototype.first = function ( type, callback )
_IDOMElement.prototype.first = function ( type, callback )
{
var c = this.childNodes;
var c = this.element.childNodes;
var l = c.length;
var elem = null;
var tc = getMatch( type );
@@ -148,9 +137,9 @@
return elem;
};
IDOMElement.prototype.last = function ( type, callback )
_IDOMElement.prototype.last = function ( type, callback )
{
var c = this.childNodes;
var c = this.element.childNodes;
var l = c.length - 1;
var elem = null;
var tc = getMatch( type );
@@ -170,7 +159,7 @@
return elem;
};
IDOMElement.prototype.contains = function ( target )
_IDOMElement.prototype.contains = function ( target )
{
if( target.parentElement )
{
@@ -184,7 +173,7 @@
};
// attribute keys
IDOMElement.prototype.aKeys = function()
_IDOMElement.prototype.aKeys = function()
{
var ikeys = [];
var attrs = this.element.attributes;
@@ -196,14 +185,14 @@
return ikeys;
};
IDOMElement.prototype.reverseChild = function()
_IDOMElement.prototype.reverseChild = function()
{
var l = this.childNodes.length - 1;
var l = this.element.childNodes.length - 1;
while( -1 < -- l )
{
this.appendChild( this.childNodes[l] );
this.element.appendChild( this.element.childNodes[l] );
}
};
ns[ NS_EXPORT ]( EX_CLASS, "IDOMElement", IDOMElement );
ns[ NS_EXPORT ]( EX_CLASS, "IDOMElement", _IDOMElement );
})();
+22 -17
View File
@@ -1,8 +1,11 @@
(function(){
var ns = __namespace( "Dandelion" );
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var EventKey = __import( "System.utils.EventKey" );
/** @constructor
* @extends Array
*/
var EvtsArr = function () { Array.call( this ); };
/** @param {System.utils.EventKey} e */
@@ -11,7 +14,7 @@
var l = this.length;
for( var i = 0; i < l; i ++ )
{
/** @type {System.utils.EventKey} */
/** @type {typeof System.utils.EventKey} */
var evt = this[i];
if( evt.type == e.type && evt.handler == e.handler )
{
@@ -24,16 +27,14 @@
__extends( EvtsArr, Array );
/** @constructor */
var IDOMObject = function ( obj, sw )
{
if ( obj instanceof IDOMObject ) return obj;
if ( sw )
{
this["addEventListener"] = this.addEventListener.bind(obj);
this["addEventListeners"] = this.addEventListeners.bind(this);
this["hasListener"] = this.hasListener.bind(obj);
this["removeEventListener"] = this.removeEventListener.bind(obj);
this.obj = /** @type {EventTarget} */ (obj);
}
else if ( obj )
{
@@ -57,6 +58,10 @@
return null;
};
/**
* @param {*} event
* @param {function(Event): void=} handler
*/
IDOMObject.prototype.addEventListener = function (event, handler)
{
var e;
@@ -90,18 +95,18 @@
this._events[0] = e;
}
if( this.addEventListener )
if( this.obj.addEventListener )
{
this.addEventListener( e.type, e.handler, false );
this.obj.addEventListener( e.type, e.handler, false );
}
// IE
else if( this.attachEvent )
else if( this.obj.attachEvent )
{
this.attachEvent('on' + e.type, e.handler);
this.obj.attachEvent('on' + e.type, e.handler);
}
else
{
this['on' + e.type] = e.handler;
this.obj['on' + e.type] = e.handler;
}
return true;
};
@@ -110,7 +115,7 @@
{
if(evtKeys instanceof Array)
{
for (var i in evtKeys)
for(var i = 0, l = evtKeys.length; i < l; i ++)
{
this.addEventListener(evtKeys[i]);
}
@@ -129,18 +134,18 @@
delete this._events[ this._events.indexOf(e) ];
}
if( this.removeEventListener )
if( this.obj.removeEventListener )
{
this.removeEventListener( e.type, e.handler );
this.obj.removeEventListener( e.type, e.handler );
}
// IE
else if( this.detachEvent )
else if( this.obj.detachEvent )
{
this.detachEvent( 'on' + e.type, e.handler );
this.obj.detachEvent( 'on' + e.type, e.handler );
}
else
{
this['on' + e.type] = null;
this.obj['on' + e.type] = null;
}
};
+1 -1
View File
@@ -49,7 +49,7 @@
{
if ( iKeys instanceof Array )
{
for (var i in iKeys)
for (var i = 0, l = iKeys.length; i < l; i ++)
{
tmp.setAttribute( iKeys[i].keyName, iKeys[i].keyValue );
}
+19 -8
View File
@@ -12,28 +12,39 @@
var stepper = function( args )
{
var thisTime = new Date().getTime();
for ( var i in tList )
var thisTime = Date.now();
var w = 0;
for (var i = 0, l = tList.length; i < l; i++)
{
var f = tList[i];
if( f && thisTime > f[2] )
if (!f)
continue;
if (thisTime > f[2])
{
try
{
if( f[0]() )
if (f[0]())
{
f[1]();
delete tList[i];
continue;
}
else f[2] = thisTime + f[3];
f[2] = thisTime + f[3];
}
catch(e)
catch (e)
{
debug.Error(e);
delete tList[i];
continue;
}
}
tList[w++] = f;
}
tList.length = w;
};
var registerTrigger = function ( trigger, handler, peekInt )
+32 -17
View File
@@ -3,7 +3,7 @@
/** @type {System.Tick} */
var utils = __import( "System.utils" );
/** @type {System.Tick} */
/** @type {typeof System.Tick} */
var Tick = __import( "System.Tick" );
/** @type {System.Debug} */
var debug = __import( "System.Debug" );
@@ -15,36 +15,46 @@
var C_ONCE = 2;
var C_ID = 3;
var C_INTVL = 4;
var C_REMOVED = 5;
var stepper = function()
{
var thisTime = new Date().getTime();
for ( var i in tList )
var thisTime = Date.now();
var w = 0;
for (var i = 0, l = tList.length; i < l; i++)
{
var f = tList[i];
if( f && thisTime > f[ C_TIME ] )
if (!f || f[C_REMOVED])
{
continue;
}
if (thisTime > f[C_TIME])
{
try
{
f[ C_CALLBACK ]();
f[C_CALLBACK]();
}
catch(e)
catch (e)
{
debug.Error(e);
delete tList[i];
continue;
}
if( f[ C_ONCE ] )
if (f[C_REMOVED] || f[C_ONCE])
{
delete tList[i];
}
else
{
f[ C_TIME ] = thisTime + f[ C_INTVL ];
continue;
}
f[C_TIME] = thisTime + f[C_INTVL];
}
tList[w++] = f;
}
tList.length = w;
};
// Should bind "func" before register
@@ -60,7 +70,7 @@
var registerPermanentTicker = function ( id, func, interval )
{
for ( var i in tList )
for ( var i = 0, l = tList.length; i < l; i ++ )
{
if( tList[i][ C_ID ] == id )
return false;
@@ -80,10 +90,15 @@
var deletePermanentTicker = function ( id )
{
// 3: id
for ( var i in tList )
for (var i = 0, l = tList.length; i < l; i++)
{
if( tList[i][ C_ID ] == id )
delete tList[i];
var f = tList[i];
if (f && f[C_ID] === id)
{
f[C_REMOVED] = true;
return;
}
}
};
+4 -1
View File
@@ -14,7 +14,10 @@
Log.writeLine( e.name + "\n\t" + e.message + "\n\t" + e.stack, Log.ERROR );
};
var Info = function()
/**
* @param {...*} _args
*/
var Info = function(_args)
{
if( st_info )
Log.writeLine( Array.prototype.join.call( arguments, " " ), Log.INFO );
+5 -5
View File
@@ -2,7 +2,7 @@
var ns = __namespace( "System.Log" );
/** @type {!Array<function(*, number): void>} */
var handler = [];
var handlers = [];
/** @const {number} */
var SYSTEM = 1;
@@ -24,9 +24,9 @@
var handled = false;
for (var i in handler)
for (var i = 0, l = handlers.length; i < l; i ++)
{
handler[i](mesg, type);
handlers[i](mesg, type);
handled = true;
}
@@ -45,7 +45,7 @@
var registerHandler = function(func)
{
var index = -1;
handler[index = handler.length] = func;
handlers[index = handlers.length] = func;
return index;
};
@@ -56,7 +56,7 @@
*/
var removeHandler = function(index)
{
delete handler[index];
delete handlers[index];
};
ns[ NS_EXPORT ]( EX_FUNC, "writeLine", writeLine );
+1 -1
View File
@@ -2,7 +2,7 @@
var ns = __namespace( "System.Net" );
/** @type {System.Debug} */
var debug = __import( "System.Debug" );
/** @type {Dandelion.IDOMObject} */
/** @type {typeof Dandelion.IDOMObject} */
var IDOMObject = __import( "Dandelion.IDOMObject" );
// Handles all http transfers
+1 -4
View File
@@ -2,10 +2,7 @@
var ns = __namespace( "System.utils" );
var IKey = ns[ NS_INVOKE ]( "IKey" );
/** @type {typeof System.utils.DataKey} */
var DataKey;
DataKey = function ( name, value )
var DataKey = function ( name, value )
{
IKey.call(
this
+8 -8
View File
@@ -2,13 +2,13 @@
var ns = __namespace( "System.utils" );
var ClassName = "IKey";
////// Class IKey
var IKey = function (name, value)
/** @constructor */
var _IKey = function (name, value)
{
if ( name && ( typeof name != "string" ) ) return;
this.keyName = name;
if( value instanceof IKey )
if( value instanceof _IKey )
{
this.keyValue = value;
}
@@ -21,8 +21,8 @@
this["keyValue"] = this.keyValue;
};
IKey.prototype.keyName = "";
IKey.prototype.keyValue = "";
_IKey.prototype.keyName = "";
_IKey.prototype.keyValue = "";
var quickDef = function()
{
@@ -36,14 +36,14 @@
var keys = [];
for( var i = 0; i < l; i += 2 )
{
keys[ keys.length ] = new IKey( arguments[i], arguments[ i + 1 ] );
keys[ keys.length ] = new _IKey( arguments[i], arguments[ i + 1 ] );
}
return keys;
};
__static_method( IKey, "quickDef", quickDef );
__static_method( _IKey, "quickDef", quickDef );
ns[ NS_EXPORT ]( EX_CLASS, "IKey", IKey );
ns[ NS_EXPORT ]( EX_CLASS, "IKey", _IKey );
})();
+2 -2
View File
@@ -3,8 +3,8 @@
* @param {string} title
* @param {string|HTMLElement} content
* @param {string} yes
* @param {string} no
* @param {function(boolean, ...?): void} handler
* @param {string=} no
* @param {function(boolean, ...?): void=} handler
*/
Components.MessageBox = function(title, content, yes, no, handler) {};
@@ -2,14 +2,14 @@
Components.Mouse.Clipboard = function() {};
/** @type {Function} */
Components.Mouse.Clipboard.init;
Components.Mouse.Clipboard.prototype.init;
/** @type {Function} */
Components.Mouse.Clipboard.setTextToCopy;
Components.Mouse.Clipboard.prototype.setTextToCopy;
/** @type {Function} */
Components.Mouse.Clipboard.onMouseOver;
Components.Mouse.Clipboard.prototype.onMouseOver;
/** @type {Function} */
Components.Mouse.Clipboard.onMouseOut;
Components.Mouse.Clipboard.prototype.onMouseOut;
/** @type {Function} */
Components.Mouse.Clipboard._textCopied;
Components.Mouse.Clipboard.prototype._textCopied;
/** @type {Function} */
Components.Mouse.Clipboard.capture;
Components.Mouse.Clipboard.prototype.capture;
@@ -1,2 +1,8 @@
/** @constructor */
Components.Mouse.ContextMenu = function() {};
/** @constructor
* @param {HTMLElement} target
* @param {Array<*>} items
* @param {string} whichButton
* @param {HTMLElement} menuInsideTarget
* @param {Object<string,*>} overrides
*/
Components.Mouse.ContextMenu = function(target, items, whichButton, menuInsideTarget, overrides) {};
+6 -2
View File
@@ -1,5 +1,9 @@
/** @constructor */
Dandelion.IDOMElement = function (){}
/** @constructor
* @extends {Dandelion.IDOMObject}
* @param {*} el
* @param {boolean} sw
*/
Dandelion.IDOMElement = function (el, sw){}
/** @type {Function} */
Dandelion.IDOMElement.prototype.getDAttribute = function() {};
+9 -6
View File
@@ -1,11 +1,14 @@
/** @constructor */
Dandelion.IDOMObject = function (){}
/** @constructor
* @param {*} obj
* @param {boolean=} sw
*/
Dandelion.IDOMObject = function (obj, sw){}
/** @type {Function} */
Dandelion.IDOMObject.addEventListener;
Dandelion.IDOMObject.prototype.addEventListener;
/** @type {Function} */
Dandelion.IDOMObject.addEventListeners;
Dandelion.IDOMObject.prototype.addEventListeners;
/** @type {Function} */
Dandelion.IDOMObject.hasListener;
Dandelion.IDOMObject.prototype.hasListener;
/** @type {Function} */
Dandelion.IDOMObject.removeEventListener;
Dandelion.IDOMObject.prototype.removeEventListener;
+6 -2
View File
@@ -19,8 +19,12 @@ Dandelion.wrapna = function() {};
/** @type {function(string): !HTMLElement} */
Dandelion.textNode = function() {};
/** @type {function(string): !HTMLElement} */
Dandelion.bubbleUp = function() {};
/**
* @param {*} elem
* @param {function(*): boolean} cond
* @return {?HTMLElement}
*/
Dandelion.bubbleUp = function(elem, cond) {};
/** @type {function(HTMLElement, function(HTMLElement): boolean): void} */
Dandelion.chainUpApply = function() {};
+8 -8
View File
@@ -1,14 +1,14 @@
/** @constructor */
System.Global = function (){}
/** @type {Boolean} */
System.Global.debug;
/** @type {boolean} */
System.Global.prototype.debug;
/** @type {Boolean} */
System.Global.IE;
/** @type {boolean} */
System.Global.prototype.IE;
/** @type {Boolean} */
System.Global.SECURE_HTTP;
/** @type {boolean} */
System.Global.prototype.SECURE_HTTP;
/** @type {Boolean} */
System.Global.MOBILE;
/** @type {boolean} */
System.Global.prototype.MOBILE;
+5 -3
View File
@@ -1,10 +1,12 @@
/** @constructor
* @extends {System.utils.IKey}
* @param {string} key
* @param {function(Event): *} callback
*/
System.utils.EventKey = function (){};
System.utils.EventKey = function (key, callback){};
/** @type {string} */
System.utils.EventKey.type;
System.utils.EventKey.prototype.type;
/** @type {Function} */
System.utils.EventKey.handler;
System.utils.EventKey.prototype.handler;
+2 -2
View File
@@ -1,14 +1,14 @@
/**
* @constructor
* @param {string} keyName
* @param {string} keyValue
* @param {*} keyValue
*/
System.utils.IKey = function(keyName, keyValue) {};
/** @type {string} */
System.utils.IKey.prototype.keyName;
/** @type {string} */
/** @type {string|System.utils.IKey} */
System.utils.IKey.prototype.keyValue;
/** @type {function(...?): !Array<!System.utils.IKey>} */
+6 -4
View File
@@ -1,4 +1,6 @@
/** @type {Object} */
_AstConf_.Article = {};
/** @type {string} */
_AstConf_.Article.id;
/**
* @typedef {{
* id: string,
* }}
*/
_AstConf_.Article;
+7 -6
View File
@@ -1,6 +1,7 @@
/** @type {Object} */
_AstConf_.Comment = {};
/** @type {string} */
_AstConf_.Comment.processor;
/** @type {string} */
_AstConf_.Comment.siteKey;
/**
* @typedef {{
* processor: string,
* siteKey: string
* }}
*/
_AstConf_.Comment;
@@ -1,4 +1,6 @@
/** @type {Object} */
_AstConf_.Notification = {};
/** @type {string} */
_AstConf_.Notification.processor;
/**
* @typedef {{
* processor: string
* }}
*/
_AstConf_.Notification;
+8 -9
View File
@@ -1,9 +1,8 @@
/** @type {Object} */
_AstConf_.UserInfo = {};
/** @type {string} */
_AstConf_.UserInfo.name;
/** @type {string} */
_AstConf_.UserInfo.website;
/** @type {string} */
_AstConf_.UserInfo.avatar;
/**
* @typedef {{
* name: string,
* website: string,
* avatar: string
* }}
*/
_AstConf_.UserInfo;
@@ -1,8 +1,8 @@
/** @type {Object} */
_AstJson_.AJaxGetNotis = {};
/** @type {string} */
_AstJson_.AJaxGetNotis.mesg;
/** @type {string} */
_AstJson_.AJaxGetNotis.id;
/** @type {string} */
_AstJson_.AJaxGetNotis.date;
/**
* @typedef {{
* id: string,
* mesg: string,
* data: string
* }}
*/
_AstJson_.AJaxGetNotis;