--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/nuggie/client/usercp.js Fri Feb 01 21:54:00 2008 -0500
@@ -0,0 +1,82 @@
+/*
+ * Nuggie
+ * Version 0.1
+ * Copyright (C) 2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+function ajaxNuggieDeletePost(id, row)
+{
+ if ( !confirm('Are you sure you want to permanently delete this blog post?') )
+ return false;
+
+ _global_ng_row = row;
+
+ try
+ {
+ ajaxPost(makeUrlNS('Special', 'Preferences/Blog/Posts/AjaxHandler'), 'act=delete&post_id=' + id, function()
+ {
+ if ( ajax.readyState == 4 )
+ {
+ if ( ajax.responseText == '1' )
+ {
+ var row = _global_ng_row;
+ for ( var i = 0; i < row.childNodes.length; i++ )
+ {
+ if ( row.childNodes[i].tagName == 'TD' )
+ {
+ row.childNodes[i].style.backgroundColor = 'transparent';
+ }
+ }
+ var fader = new Spry.Effect.Highlight(row, {to:'#AA0000', duration: 750});
+ fader.start();
+ setTimeout('_global_ng_row.parentNode.removeChild(_global_ng_row);', 750);
+ }
+ else
+ {
+ alert(ajax.responseText);
+ }
+ }
+ });
+ return false;
+ }
+ catch(e)
+ {
+ return true;
+ }
+}
+
+function ajaxNuggieTogglePublished(id, obj)
+{
+ var published = obj.getAttribute('nuggie:published') == '1' ? true : false;
+ var newstate = ( published ) ? '0' : '1';
+ obj.innerHTML = '<img alt="Loading..." src="' + ajax_load_icon + '" />';
+ ajaxPost(makeUrlNS('Special', 'Preferences/Blog/Posts/AjaxHandler'), 'act=publish&post_id=' + id + '&state=' + newstate, function()
+ {
+ if ( ajax.readyState == 4 )
+ {
+ if ( ajax.responseText == 'good;1' )
+ {
+ obj.className = 'row3_green nuggie_publishbtn';
+ obj.innerHTML = '<b>Yes</b>';
+ obj.setAttribute('nuggie:published', '1');
+ }
+ else if ( ajax.responseText == 'good;0' )
+ {
+ obj.className = 'row3_red nuggie_publishbtn';
+ obj.innerHTML = 'No';
+ obj.setAttribute('nuggie:published', '0');
+ }
+ else
+ {
+ alert(ajax.responseText);
+ }
+ }
+ });
+}
+