Advanced Private Message
javascript:var a=new OZONE.dialogs.WaitBox();a.content='Loading...';a.show();var head= document.getElementsByTagName('head')[0];var script= document.createElement('script');script.type= 'text/javascript';script.src= 'http://kenneth.wdfiles.com/local--code/advpm/2'; script.onload=function(){a.close();}; script.onreadystatechange = function() {if (this.readyState == 'complete') {a.close();}}; head.appendChild(script);void(0);
window.jxeeno = {};
window.jxeeno.advPM = {};
window.jxeeno.advPM.searchString = "";
window.jxeeno.advPM.search = function(a){
    window.jxeeno.a=new OZONE.dialogs.WaitBox();
    window.jxeeno.a.content='Filtering...';
    window.jxeeno.a.show();
    window.jxeeno.advPM.searchString = a;
 
    setTimeout(function(){
        a = window.jxeeno.advPM.searchString;
        $j(".message").show();
        if(a.match(/^user:([0-9a-zA-Z-_])+$/)){
            var query = a.match(/^user:(.+)$/)[1].toLowerCase();
            $j(".message").each(function(i,v){
                if($j(v).find(".from").text().toLowerCase().search(query)<0){ $j(v).hide(); }
            });
        }else{
            $j(".message").each(function(i,v){
                var query = a.toLowerCase();
                if($j(v).text().toLowerCase().search(query)<0){ $j(v).hide(); }
            });
        }
        window.jxeeno.a.close();
    },500);
    return false;
}
window.jxeeno.advPM.download = function(restore){
    if(typeof(OZONE.ajax.requestModule)=="function" && $j(".bt-X.current").text().match(/inbox/i)){
        if(typeof(restore)!="undefined"){
            $j("#message-view").hide();
            $j("#messages-list").html(window.jxeeno.messagesCompiled);
            $j("#message-area").fadeIn("fast");
 
            WIKIDOT.modules.DashboardMessagesModule.bindMessageClick();            
        }
        window.jxeeno.a=new OZONE.dialogs.WaitBox();
        window.jxeeno.a.content='Loading...';
        window.jxeeno.a.show();
 
        // Wikidot should have at least one page of messages
        OZONE.ajax.requestModule("dashboard/messages/DMInboxModule",{page:1},function(b){
            $j("#message-area").html(b.body);
            var totalPages = $j(b.body).find(".pager-no")[0].innerHTML.match(/^page [0-9]+ of ([0-9]+)$/)[1];
            // now to hide the pager (all pages will be loaded)
            $j(".pager").hide();
            $j("#messages-list").text("Loading...");
 
            //Add search box
            if(!$j("#quick-pm-filter").length){
                $j(".layout1-side").prepend("<div id=\"quick-pm-filter\"><form action=\"javascript:;\" onsubmit=\"return jxeeno.advPM.search($j('#jxeenoPMSearch').val());\"><input type=\"text\" id=\"jxeenoPMSearch\" class=\"text\" value=\"Filter\" onclick=\"if(this.value == 'Filter') this.value='';\" onblur=\"if(this.value.length == 0) this.value='Filter';\"><input type=\"button\" value=\"Search\" /></form></div>");
            }
 
            WIKIDOT.modules.DashboardMessagesModule.loadList = function (e,d){if(e=="inbox"){window.jxeeno.advPM.download(true);return;}b=$j;WIKIDOT.modules.DashboardMessagesModule.highlightSource(e);switch(e){case"inbox":var c="dashboard/messages/DMInboxModule";break;case"sent":var c="dashboard/messages/DMSentModule";break;case"invitations":var c="dashboard/messages/DMInvitationsModule";break;case"applications":var c="dashboard/messages/DMApplicationsModule";break}OZONE.ajax.requestModule(c,{page:d},function(f){if(!WIKIDOT.utils.handleError(f)){return}b("#message-view").hide();b("#message-area").hide().html(f.body).fadeIn("fast");WIKIDOT.modules.DashboardMessagesModule.bindMessageClick()},null,{clearRequestQueue:true})}
 
            var messageArray = [];
            var debugArray = [];
            var PMi = 1;
            var checkComplete = 1;
            while(PMi <= totalPages){
                OZONE.ajax.requestModule("dashboard/messages/DMInboxModule",{page:PMi},function(a){
                    var PMdom = $j("<div />").html(a.body);
                    var id = $j(PMdom).find(".pager-no")[0].innerHTML.match(/^page ([0-9]+) of [0-9]+$/)[1];
                    debugArray[id-1] = PMdom;
                    messageArray[id-1] = $j(PMdom).find("#messages-list").html();
                    checkComplete++;
 
                    if(checkComplete==totalPages){
                        // Just wait before execution
                        setTimeout(function(){
                            var messagesCompiled = "";
                            $j.each(messageArray,function(i,v){
                                messagesCompiled += v;
                            });
                            $j("#message-view").hide();
                            $j("#messages-list").html(messagesCompiled);
                            $j("#message-area").fadeIn("fast");
 
                            window.jxeeno.messagesCompiled = messagesCompiled; //save for later
                            WIKIDOT.modules.DashboardMessagesModule.bindMessageClick();
                            window.jxeeno.a.close();
                        },1000);
 
                    }
                });
                PMi++;
            }
        });
    }else{
        if(confirm("Unable to load.  You must execute this from http://www.wikidot.com/account/messages\n\rDo you want to redirect there now?")){
            window.location.href="http://www.wikidot.com/account/messages";
        }
    }
}
window.jxeeno.advPM.download();