penguin/AstroJS

Javascript framework for my blog

botanjs/src/Astro/Blog/Layout/Subs/Manage.js

raw ยท 1088 bytes

(function(){
	var ns = __namespace( "Astro.Blog.Layout.Subs.Manage" );
	/** @type {typeof Components.MessageBox} */
	var MessageBox                              = __import( "Components.MessageBox" );
	/** @type {typeof Dandelion} */
	var Dand                                    = __import( "Dandelion" );
	/** @type {Astro.Bootstrap} */
	var Bootstrap                               = __import( "Astro.Bootstrap" );
	/** @type {function(...?): Dandelion.IDOMElement} */
	var IDOMElement                             = __import( "Dandelion.IDOMElement" );

	var init = function ()
	{
		/** @type {function(...?): Dandelion.IDOMElement} */
		var banbtn = Dand.id( "action-ban", true );

		if( banbtn )
		{
			banbtn.addEventListener( "Click", function( e ) {
				e.preventDefault();

				var msgBox = new MessageBox(
					"Ban this address"
					, "This action cannot be undone, confirm?"
					, "Yes", "No"
					, function( _confirm ) {
						if( !_confirm ) return;
						window.location = banbtn.getDAttribute( "href" );
					} ).show();
			} );
		}
	};

	Bootstrap.regInit( init );
})();