forked from Botanical/BotanJS
		
	UserComment subscription
This commit is contained in:
		@@ -516,10 +516,14 @@
 | 
			
		||||
		{
 | 
			
		||||
			// Remove capcha
 | 
			
		||||
			new IDOMElement().lootChildren( Dand.id( "recaptcha_field" ) );
 | 
			
		||||
			Recaptcha.render( "recaptcha_field", {
 | 
			
		||||
				"theme": "light"
 | 
			
		||||
				, "sitekey": Config.siteKey
 | 
			
		||||
			} );
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				Recaptcha.render( "recaptcha_field", {
 | 
			
		||||
					"theme": "light"
 | 
			
		||||
					, "sitekey": Config.siteKey
 | 
			
		||||
				} );
 | 
			
		||||
			}
 | 
			
		||||
			catch( ex ) { }
 | 
			
		||||
 | 
			
		||||
			openCaptcha();
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -47,10 +47,6 @@
 | 
			
		||||
 | 
			
		||||
.b_bodyWrapper a { color: #f15a24; }
 | 
			
		||||
 | 
			
		||||
.b_notify { background-color: slategrey; }
 | 
			
		||||
.b_notify:before { content: 'Follow'; }
 | 
			
		||||
.b_notify:after { content: 'Unfollow'; }
 | 
			
		||||
 | 
			
		||||
.b_edit {
 | 
			
		||||
	background-color: yellowgreen;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -98,16 +98,17 @@
 | 
			
		||||
 | 
			
		||||
			for( var i in e.data )
 | 
			
		||||
			{
 | 
			
		||||
				var data = e.data[i];
 | 
			
		||||
				var li
 | 
			
		||||
					, li_s = [
 | 
			
		||||
							// On/off toggle
 | 
			
		||||
							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
 | 
			
		||||
					li_s[2] = Dand.wrap(
 | 
			
		||||
@@ -115,7 +116,7 @@
 | 
			
		||||
						, null
 | 
			
		||||
						, "nt_tcount"
 | 
			
		||||
						, e.data[i].count + ""
 | 
			
		||||
						, new DataKey( "count", e.data[i].count )
 | 
			
		||||
						, new DataKey( "count", data.count )
 | 
			
		||||
					);
 | 
			
		||||
					// Active
 | 
			
		||||
					keys[ keys.length ] = new IKey( "active", 1 );
 | 
			
		||||
@@ -152,6 +153,7 @@
 | 
			
		||||
		var createContextMenu = function(e)
 | 
			
		||||
		{
 | 
			
		||||
			var items = [], menuShow = false;
 | 
			
		||||
			var hasNotis = 0 < e.data.length;
 | 
			
		||||
 | 
			
		||||
			for( var n in e.data )
 | 
			
		||||
			{
 | 
			
		||||
@@ -159,7 +161,7 @@
 | 
			
		||||
				var data = e.data[n];
 | 
			
		||||
				// Create items
 | 
			
		||||
				items[ items.length ] = new IKey(
 | 
			
		||||
					data.message 
 | 
			
		||||
					data.mesg
 | 
			
		||||
					, new EventKey(
 | 
			
		||||
						"m_" + data.id
 | 
			
		||||
						, readNotification.bind( data )
 | 
			
		||||
@@ -177,10 +179,10 @@
 | 
			
		||||
				// showMenu/hideMenu overrides style settings
 | 
			
		||||
				, {
 | 
			
		||||
					"class": "nt_container"
 | 
			
		||||
					, "showMenu": function(stage, event)
 | 
			
		||||
					, "showMenu": function( stage, event )
 | 
			
		||||
					{
 | 
			
		||||
						if( stage.className == "nt_date" ) return;
 | 
			
		||||
						if( menuShow ) return;
 | 
			
		||||
						if( !hasNotis || menuShow ) return;
 | 
			
		||||
						bodyStyle.marginLeft = "1em";
 | 
			
		||||
						bodyStyle.marginRight = "-1em";
 | 
			
		||||
						bodyStyle.opacity = 0;
 | 
			
		||||
@@ -194,7 +196,7 @@
 | 
			
		||||
							menuShow = true;
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
					, "hideMenu": function(stage)
 | 
			
		||||
					, "hideMenu": function( stage )
 | 
			
		||||
					{
 | 
			
		||||
						if( stage.className == "nt_date" ) return;
 | 
			
		||||
						if( !menuShow ) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,7 @@
 | 
			
		||||
.b_notify { background-color: #222 !important; }
 | 
			
		||||
.b_notify:before { content: 'Mute'; }
 | 
			
		||||
.b_notify:after { content: 'Notify'; }
 | 
			
		||||
 | 
			
		||||
.uc_ntoggle {
 | 
			
		||||
	font-family: custom-sans;
 | 
			
		||||
	vertical-align: top;
 | 
			
		||||
@@ -36,7 +40,7 @@
 | 
			
		||||
 | 
			
		||||
.cr_ntoggle:before {
 | 
			
		||||
	content: '..';
 | 
			
		||||
	background-color: slategrey;
 | 
			
		||||
	background-color: orange;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.cr_ntoggle:after { content: '!'; }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,27 +1,60 @@
 | 
			
		||||
/*
 | 
			
		||||
(function(){
 | 
			
		||||
	var ns = __namespace( "Astro.Blog.Components.ToggleButton.CommentToggle" );
 | 
			
		||||
 | 
			
		||||
	new ToggleButton('toggle_follow', nProcessor, {
 | 
			
		||||
	enable: { action: 'enable', tid: 3, cid: 1 },
 | 
			
		||||
	disable: { action: 'disable', tid: 3, cid: 1 }
 | 
			
		||||
	});
 | 
			
		||||
	var ToggleButton = __import( "Astro.Blog.Components.ToggleButton" );
 | 
			
		||||
 | 
			
		||||
	new ToggleButton('uc_ntoggle', nProcessor, {
 | 
			
		||||
	enable: { action: 'enable', tid: 1, cid: 1645 },
 | 
			
		||||
	disable: { action: 'disable', tid: 1, cid: 1645 }
 | 
			
		||||
	});
 | 
			
		||||
	/** @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" );
 | 
			
		||||
 | 
			
		||||
	new ToggleButton('toggle_publish', '../../../user/ajax-set_article', {
 | 
			
		||||
	enable: { draft: 0, article_id: 1645 },
 | 
			
		||||
	disable: { draft: 1, article_id: 1645 }
 | 
			
		||||
	});
 | 
			
		||||
	/** @type {_AstConf_.CommentToggle} */
 | 
			
		||||
	var settings = Conf.get( "CommentToggle" );
 | 
			
		||||
 | 
			
		||||
	for(var i in commList) {
 | 
			
		||||
	new ToggleButton('cr_ntoggle_' + commList[i], nProcessor, {
 | 
			
		||||
	enable: { action: 'enable', tid: 2, cid: commList[i] },
 | 
			
		||||
	disable: { action: 'disable', tid: 2, cid: commList[i] }
 | 
			
		||||
	});
 | 
			
		||||
	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("toggle_publish", "../../../user/ajax-set_article", {
 | 
			
		||||
		enable: { draft: 0, article_id: 1645 },
 | 
			
		||||
		disable: { draft: 1, article_id: 1645 }
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		for(var i in commList) {
 | 
			
		||||
		new ToggleButton("cr_ntoggle_" + commList[i], nProcessor, {
 | 
			
		||||
		enable: { action: "enable", tid: 2, cid: commList[i] },
 | 
			
		||||
		disable: { action: "disable", tid: 2, cid: commList[i] }
 | 
			
		||||
		});
 | 
			
		||||
		*/
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Bootstrap.regInit( init );
 | 
			
		||||
})();
 | 
			
		||||
//*/
 | 
			
		||||
 
 | 
			
		||||
@@ -7,13 +7,15 @@
 | 
			
		||||
	padding: 0.2em 0.5em;
 | 
			
		||||
	margin:  0.5em 0.2em;
 | 
			
		||||
 | 
			
		||||
	background-color: grey;
 | 
			
		||||
	background-color: #222;
 | 
			
		||||
	color: white;
 | 
			
		||||
 | 
			
		||||
	cursor: default;
 | 
			
		||||
 | 
			
		||||
	overflow: hidden;
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
 | 
			
		||||
	opacity: 0.8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btn_toggle > .btn_space {
 | 
			
		||||
@@ -22,6 +24,7 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btn_toggle:hover {
 | 
			
		||||
	opacity: 1;
 | 
			
		||||
	text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -62,7 +65,7 @@
 | 
			
		||||
 | 
			
		||||
.btn_toggle:after {
 | 
			
		||||
	content: '';
 | 
			
		||||
	background-color: royalblue;
 | 
			
		||||
	background-color: #4169E1;
 | 
			
		||||
	top: 100%;
 | 
			
		||||
 | 
			
		||||
	-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 */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.btn_toggle[active="1"]:after {
 | 
			
		||||
.btn_toggle[data-active="1"]:after {
 | 
			
		||||
	top: 0%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.btn_toggle[active="1"]:before {
 | 
			
		||||
.btn_toggle[data-active="1"]:before {
 | 
			
		||||
	top: -100%;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,37 +9,38 @@
 | 
			
		||||
	var Bootstrap                        = __import( "Astro.Bootstrap" );
 | 
			
		||||
	/** @type {Astro.Blog} */
 | 
			
		||||
	var config                           = __import( "Astro.Blog.Config" );
 | 
			
		||||
	/** @type {System.utils.DataKey} */
 | 
			
		||||
	var DataKey                          = __import( "System.utils.DataKey" );
 | 
			
		||||
 | 
			
		||||
	var postData                         = __import( "System.Net.postData" );
 | 
			
		||||
 | 
			
		||||
	var ToggleButton = function ( elem, processor, obj )
 | 
			
		||||
	{
 | 
			
		||||
		var stage = Dand.id( elem );
 | 
			
		||||
		var stage = Dand.id( elem, true );
 | 
			
		||||
		if( !stage ) return;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		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
 | 
			
		||||
			{
 | 
			
		||||
				stage.setAttribute('active', 1);
 | 
			
		||||
				stage.setAttribute( new DataKey( "active", 1 ) );
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		var nError = function (args)
 | 
			
		||||
		{
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
		;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		IDOMElement(stage).addEventListener(
 | 
			
		||||
			'Click'
 | 
			
		||||
		stage.addEventListener(
 | 
			
		||||
			"Click"
 | 
			
		||||
			, function (e) {
 | 
			
		||||
				var _action = stage.getAttribute( "active" ) == 1
 | 
			
		||||
				var _action = stage.getDAttribute( "active" ) == 1
 | 
			
		||||
					? obj[ "disable" ]
 | 
			
		||||
					: obj[ "enable" ]
 | 
			
		||||
				;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/** @type {Object} */
 | 
			
		||||
_AstJson_.AJaxGetNotis = {};
 | 
			
		||||
/** @type {String} */
 | 
			
		||||
_AstJson_.AJaxGetNotis.message;
 | 
			
		||||
_AstJson_.AJaxGetNotis.mesg;
 | 
			
		||||
/** @type {String} */
 | 
			
		||||
_AstJson_.AJaxGetNotis.id;
 | 
			
		||||
/** @type {String} */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user