forked from Botanical/BotanJS
Refine the notification panel
This commit is contained in:
@@ -34,10 +34,10 @@
|
||||
var stage = Dand.id( "notifications" );
|
||||
var bodyStyle = Dand.id( "nt_body" ).style;
|
||||
|
||||
/** @type {_AstConf_.Notification} */
|
||||
var conf = Config.get( "Notification" );
|
||||
var base_path = Config.get( "BasePath" );
|
||||
|
||||
var processor = base_path + conf.paths.get_mesg;
|
||||
var processor = conf.processor;
|
||||
var contextMenu;
|
||||
|
||||
var itemsMenu;
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
var followLink = function(e)
|
||||
{
|
||||
window.location = base_path + this.link;
|
||||
window.location = this.link;
|
||||
};
|
||||
|
||||
var toggleFollow = function(e)
|
||||
@@ -155,20 +155,22 @@
|
||||
|
||||
for( var n in e.data )
|
||||
{
|
||||
/** @type {_AstJson_.AJaxGetNotis} */
|
||||
var data = e.data[n];
|
||||
// Create items
|
||||
items[items.length] = new IKey(
|
||||
e.data[n].message
|
||||
items[ items.length ] = new IKey(
|
||||
data.message
|
||||
, new EventKey(
|
||||
"m_" + e.data[n].id
|
||||
, readNotification.bind( e.data[n] )
|
||||
"m_" + data.id
|
||||
, readNotification.bind( data )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
items[ items.length ] = new EventKey( "Settings", popupSettings );
|
||||
Dand.glass( "nt_icon_settings", true )[0].addEventListener( "Click", popupSettings );
|
||||
|
||||
contextMenu = new ContextMenu(
|
||||
stage
|
||||
Dand.id( "nt_open_menu" )
|
||||
, items
|
||||
, "LMB"
|
||||
, nt_body
|
||||
@@ -215,16 +217,17 @@
|
||||
|
||||
for( n in e.data )
|
||||
{
|
||||
var li = contextMenu.getItemByKey( "m_" + e.data[n].id ).stage;
|
||||
/** @type {_AstJson_.AJaxGetNotis} */
|
||||
var data = e.data[n];
|
||||
|
||||
var li = contextMenu.getItemByKey( "m_" + data.id ).stage;
|
||||
li.appendChild(
|
||||
Dand.wrapc(
|
||||
"nt_date"
|
||||
, smstamp( new Date( Number( e.data[n].date ) * 1000 ) )
|
||||
, smstamp( new Date( data.date ) )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
contextMenu.getItemByKey("Settings").stage.className = "nt_icon_settings";
|
||||
};
|
||||
|
||||
postData( processor, { "action": "get" }, createContextMenu );
|
||||
|
||||
Reference in New Issue
Block a user