UserComment subscription

This commit is contained in:
斟酌 鵬兄 2016-02-09 02:24:20 +08:00
parent e37a9d8a72
commit 4cc218b03a
8 changed files with 93 additions and 50 deletions

View File

@ -516,10 +516,14 @@
{ {
// Remove capcha // Remove capcha
new IDOMElement().lootChildren( Dand.id( "recaptcha_field" ) ); new IDOMElement().lootChildren( Dand.id( "recaptcha_field" ) );
try
{
Recaptcha.render( "recaptcha_field", { Recaptcha.render( "recaptcha_field", {
"theme": "light" "theme": "light"
, "sitekey": Config.siteKey , "sitekey": Config.siteKey
} ); } );
}
catch( ex ) { }
openCaptcha(); openCaptcha();
} }

View File

@ -47,10 +47,6 @@
.b_bodyWrapper a { color: #f15a24; } .b_bodyWrapper a { color: #f15a24; }
.b_notify { background-color: slategrey; }
.b_notify:before { content: 'Follow'; }
.b_notify:after { content: 'Unfollow'; }
.b_edit { .b_edit {
background-color: yellowgreen; background-color: yellowgreen;
} }

View File

@ -98,16 +98,17 @@
for( var i in e.data ) for( var i in e.data )
{ {
var data = e.data[i];
var li var li
, li_s = [ , li_s = [
// On/off toggle // On/off toggle
Dand.wrap( "span", null, "nt_switch" ) Dand.wrap( "span", null, "nt_switch" )
, Dand.wrap( "span", null, "nt_tname", e.data[i].name ) , Dand.wrap( "span", null, "nt_tname", data.name )
] ]
, keys = [ new DataKey( "tid", i ) ] , keys = [ new DataKey( "tid", data.type ) ]
; ;
if( e.data[i].hasOwnProperty("count") ) if( data.hasOwnProperty("count") )
{ {
// type count // type count
li_s[2] = Dand.wrap( li_s[2] = Dand.wrap(
@ -115,7 +116,7 @@
, null , null
, "nt_tcount" , "nt_tcount"
, e.data[i].count + "" , e.data[i].count + ""
, new DataKey( "count", e.data[i].count ) , new DataKey( "count", data.count )
); );
// Active // Active
keys[ keys.length ] = new IKey( "active", 1 ); keys[ keys.length ] = new IKey( "active", 1 );
@ -152,6 +153,7 @@
var createContextMenu = function(e) var createContextMenu = function(e)
{ {
var items = [], menuShow = false; var items = [], menuShow = false;
var hasNotis = 0 < e.data.length;
for( var n in e.data ) for( var n in e.data )
{ {
@ -159,7 +161,7 @@
var data = e.data[n]; var data = e.data[n];
// Create items // Create items
items[ items.length ] = new IKey( items[ items.length ] = new IKey(
data.message data.mesg
, new EventKey( , new EventKey(
"m_" + data.id "m_" + data.id
, readNotification.bind( data ) , readNotification.bind( data )
@ -177,10 +179,10 @@
// showMenu/hideMenu overrides style settings // showMenu/hideMenu overrides style settings
, { , {
"class": "nt_container" "class": "nt_container"
, "showMenu": function(stage, event) , "showMenu": function( stage, event )
{ {
if( stage.className == "nt_date" ) return; if( stage.className == "nt_date" ) return;
if( menuShow ) return; if( !hasNotis || menuShow ) return;
bodyStyle.marginLeft = "1em"; bodyStyle.marginLeft = "1em";
bodyStyle.marginRight = "-1em"; bodyStyle.marginRight = "-1em";
bodyStyle.opacity = 0; bodyStyle.opacity = 0;
@ -194,7 +196,7 @@
menuShow = true; menuShow = true;
}); });
} }
, "hideMenu": function(stage) , "hideMenu": function( stage )
{ {
if( stage.className == "nt_date" ) return; if( stage.className == "nt_date" ) return;
if( !menuShow ) return; if( !menuShow ) return;

View File

@ -1,3 +1,7 @@
.b_notify { background-color: #222 !important; }
.b_notify:before { content: 'Mute'; }
.b_notify:after { content: 'Notify'; }
.uc_ntoggle { .uc_ntoggle {
font-family: custom-sans; font-family: custom-sans;
vertical-align: top; vertical-align: top;
@ -36,7 +40,7 @@
.cr_ntoggle:before { .cr_ntoggle:before {
content: '..'; content: '..';
background-color: slategrey; background-color: orange;
} }
.cr_ntoggle:after { content: '!'; } .cr_ntoggle:after { content: '!'; }

View File

@ -1,27 +1,60 @@
/*
(function(){ (function(){
var ns = __namespace( "Astro.Blog.Components.ToggleButton.CommentToggle" ); var ns = __namespace( "Astro.Blog.Components.ToggleButton.CommentToggle" );
new ToggleButton('toggle_follow', nProcessor, { var ToggleButton = __import( "Astro.Blog.Components.ToggleButton" );
enable: { action: 'enable', tid: 3, cid: 1 },
disable: { action: 'disable', tid: 3, cid: 1 } /** @type {Dandelion} */
var Dand = __import( "Dandelion" );
/** @type {Dandelion.IDOMElement} */
var IDOMElement = __import( "Dandelion.IDOMElement" );
/** @type {Astro.Bootstrap} */
var Bootstrap = __import( "Astro.Bootstrap" );
/** @type {Astro.Blog.Config} */
var Conf = __import( "Astro.Blog.Config" );
/** @type {_AstConf_.CommentToggle} */
var settings = Conf.get( "CommentToggle" );
var CommentToggle = function( id, processor, object )
{
ToggleButton.call( this, id, processor, object );
};
__extends( CommentToggle, ToggleButton );
var init = function()
{
for( var i in settings )
{
var button = settings[i];
new CommentToggle( button[0], button[1], button[2] );
}
/*
new ToggleButton("toggle_follow", "/ajax/get-notis", {
"enable": { "action": "enable", "tid": 4, "cid": aid },
"disable": { "action": "disable", "tid": 4, "cid": aid }
});
*/
/*
new ToggleButton("uc_ntoggle", nProcessor, {
enable: { action: "enable", tid: 1, cid: 1645 },
disable: { action: "disable", tid: 1, cid: 1645 }
}); });
new ToggleButton('uc_ntoggle', nProcessor, { new ToggleButton("toggle_publish", "../../../user/ajax-set_article", {
enable: { action: 'enable', tid: 1, cid: 1645 },
disable: { action: 'disable', tid: 1, cid: 1645 }
});
new ToggleButton('toggle_publish', '../../../user/ajax-set_article', {
enable: { draft: 0, article_id: 1645 }, enable: { draft: 0, article_id: 1645 },
disable: { draft: 1, article_id: 1645 } disable: { draft: 1, article_id: 1645 }
}); });
for(var i in commList) { for(var i in commList) {
new ToggleButton('cr_ntoggle_' + commList[i], nProcessor, { new ToggleButton("cr_ntoggle_" + commList[i], nProcessor, {
enable: { action: 'enable', tid: 2, cid: commList[i] }, enable: { action: "enable", tid: 2, cid: commList[i] },
disable: { action: 'disable', tid: 2, cid: commList[i] } disable: { action: "disable", tid: 2, cid: commList[i] }
}); });
*/
}
Bootstrap.regInit( init );
})(); })();
//*/

View File

@ -7,13 +7,15 @@
padding: 0.2em 0.5em; padding: 0.2em 0.5em;
margin: 0.5em 0.2em; margin: 0.5em 0.2em;
background-color: grey; background-color: #222;
color: white; color: white;
cursor: default; cursor: default;
overflow: hidden; overflow: hidden;
display: inline-block; display: inline-block;
opacity: 0.8;
} }
.btn_toggle > .btn_space { .btn_toggle > .btn_space {
@ -22,6 +24,7 @@
} }
.btn_toggle:hover { .btn_toggle:hover {
opacity: 1;
text-decoration: none; text-decoration: none;
} }
@ -62,7 +65,7 @@
.btn_toggle:after { .btn_toggle:after {
content: ''; content: '';
background-color: royalblue; background-color: #4169E1;
top: 100%; top: 100%;
-webkit-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000); -webkit-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000);
@ -72,11 +75,11 @@
transition: all 500ms cubic-bezier(0.215, 0.610, 0.355, 1.000); /* easeOutCubic */ transition: all 500ms cubic-bezier(0.215, 0.610, 0.355, 1.000); /* easeOutCubic */
} }
.btn_toggle[active="1"]:after { .btn_toggle[data-active="1"]:after {
top: 0%; top: 0%;
} }
.btn_toggle[active="1"]:before { .btn_toggle[data-active="1"]:before {
top: -100%; top: -100%;
} }

View File

@ -9,37 +9,38 @@
var Bootstrap = __import( "Astro.Bootstrap" ); var Bootstrap = __import( "Astro.Bootstrap" );
/** @type {Astro.Blog} */ /** @type {Astro.Blog} */
var config = __import( "Astro.Blog.Config" ); var config = __import( "Astro.Blog.Config" );
/** @type {System.utils.DataKey} */
var DataKey = __import( "System.utils.DataKey" );
var postData = __import( "System.Net.postData" ); var postData = __import( "System.Net.postData" );
var ToggleButton = function ( elem, processor, obj ) var ToggleButton = function ( elem, processor, obj )
{ {
var stage = Dand.id( elem ); var stage = Dand.id( elem, true );
if( !stage ) return; if( !stage ) return;
var n_toggle = function (args) var n_toggle = function (args)
{ {
if( stage.getAttribute("active") == 1 ) if( stage.getDAttribute("active") == 1 )
{ {
stage.removeAttribute('active'); stage.setAttribute( new DataKey( "active", 0 ) );
} }
else else
{ {
stage.setAttribute('active', 1); stage.setAttribute( new DataKey( "active", 1 ) );
} }
}; };
var nError = function (args) var nError = function (args)
{ {
} };
;
IDOMElement(stage).addEventListener( stage.addEventListener(
'Click' "Click"
, function (e) { , function (e) {
var _action = stage.getAttribute( "active" ) == 1 var _action = stage.getDAttribute( "active" ) == 1
? obj[ "disable" ] ? obj[ "disable" ]
: obj[ "enable" ] : obj[ "enable" ]
; ;

View File

@ -1,7 +1,7 @@
/** @type {Object} */ /** @type {Object} */
_AstJson_.AJaxGetNotis = {}; _AstJson_.AJaxGetNotis = {};
/** @type {String} */ /** @type {String} */
_AstJson_.AJaxGetNotis.message; _AstJson_.AJaxGetNotis.mesg;
/** @type {String} */ /** @type {String} */
_AstJson_.AJaxGetNotis.id; _AstJson_.AJaxGetNotis.id;
/** @type {String} */ /** @type {String} */