+ if (this.win) {
+ this.win.onbeforeunload = null;
+ this.win.close();
+ this.win = null;
+ }
+ },
+
+ activate: function (enable) {
+ if (this.enabled == enable) {
+ return true;
+ }
+ if (enable) {
+ this.disable();
+
+ this.win = window.open("moderation.php", "Moderazione", "width=800,height=600,toolbar=no,location=no,menubar=no,status=no");
+ if (this.win == null) {
+ this.disable();
+ return false;
+ }
+ // to finish initialization we wait for popup page onload event ...
+ this.win_waitonload();
+ }
+ else {
+ this.disable();
+ this.enabled = false;
+ }
+
+ },
+
+ win_waitonload: function () {
+ if (typeof(this.win.is_loaded) == 'undefined' || this.win.is_loaded != true) {
+ console.log("not ready");
+ this.tout = setTimeout(function (obj) { obj.win_waitonload(); }, 250, this);
+ }
+ else {
+ console.log("ready now!");
+ this.post_onload();
+ }
+ },
+
+ post_onload: function() {
+ var tr, td, remtr;
+
+ this.win.anc = this;
+ this.table = $(this.win, 'moder_tab');
+
+ for (i = 0 ; i < 3 ; i++) {
+ tr = document.createElement("tr");
+ for (e = 0 ; e < 2 ; e++) {
+ td = document.createElement("td");
+ td.innerHTML = "Content "+((i * 2)+e);
+ tr.appendChild(td);
+ }
+ this.table.appendChild(tr);
+ if (i == 0)
+ remtr = tr;
+ }
+ this.table.removeChild(remtr);
+ this.enabled = true;
+ },
+
+ onunload: function() {
+ act_moderate();
+ },
+
+ is_enabled: function() {
+ return (this.enabled);
+ }// ,
+
+ //add: function(item) {
+ // this.item.append(new ModerateItem(item));
+ //}
+ // send_mesg("moderate|"+(enable ? "false" | "true"));
+
+}
+
+function moderate(enable)
+{
+ return (g_moder.activate(enable));
+}
+
+var g_moder = new Moderate();
+
+function act_moderate()
+{
+ send_mesg("moderate|"+(g_moder.is_enabled() ? "false" : "true"));