The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Application: Actions of moderation

+12
Poser
Rukiafan
SarkZKalie
Zed is Not Dead
Beyonder
Joost
Ange Tuteur
Milouze14
darki
SLGray
Van-Helsing
JScript
16 posters

Go down

Application: Actions of moderation Empty Application: Actions of moderation

Post by JScript July 1st 2015, 10:45 pm

* Description: This application shows a popup menu for the moderation in the list of topics.

Note: You need to translate the texts into your local language.

In your ACP: Modules -> HTML&JAVASCRIPT -> JavaScript codes management -> [Create a new JavaScript]
Title *: <- Whatever you want
Placement : <- In the sub-forums
Javascript Code * : <- Select, copy and paste the code below in this field:
Code:

/***
 * Application: Actions of moderation.
 * Description: This application shows a shortcut menu for the moderation in the list of topics.
 * Version: 1.03182014-jq1.9.1 - (Dodekatheon / 2) + (Hermes = Zeus + Maia)
 * Made and Optimizations by JScript - 2014/03/18
 * View more in: http://ajuda.forumeiros.com
 * Copyright (c) 2013 JScript <jscriptbrasil at live dot com>
 * This work is free. You can redistribute it and/or modify it
 * under the terms of the WTFPL, Version 2
 */
/***
* System Defined Variables - Do not edit if you don't know!
***/
var oMTConfig = {
    sErrorMsg: '',
    oTopicTitle: {},
    sTopicHref: '',
    iTopicID: 0,
    sTopicTitle: '',
    sContent:
        '<a title="Ações da Moderação" class="ipsModMenu" href="#">&nbsp;</a>',
    sMenu:
        '<ul style="display: none; position: absolute; z-index: 9999;" class="ipbmenu_content" id="topic_mod_menucontent">' +
            '<li style="z-index: 10000;"><a title="Renomear tópico" href="" id="t_rename" onclick="_rename_Topic();return false;" style="z-index: 10000;">Renomear tópico</a></li>' +
            //'<li style="z-index: 10000;"><a title="Destacar tópico" href="" id="t_pin" style="z-index: 10000;">Destacar tópico</a></li>' +
            //'<li style="z-index: 10000;"><a title="Mudar ícone" href="" id="t_icon" style="z-index: 10000;">Mudar ícone</a></li>' +
            '<li style="z-index: 10000;"><a title="Fechar tópico" href="" id="t_lock" style="z-index: 10000;">Fechar tópico</a></li>' +
            '<li style="z-index: 10000;"><a title="Mover tópico" href="" id="t_move" style="z-index: 10000;">Mover tópico</a></li>' +
            '<li style="z-index: 10000;"><a title="Enviar para lixeira" href="" id="t_hide" style="z-index: 10000;">Reciclar (Ocultar)</a></li>' +
            '<li style="z-index: 10000;"><a title="Excluir tópico" href="" id="t_delete" style="z-index: 10000;">Excluir tópico</a></li>' +
        '</ul>',
    sCSS:
        '<style>' +
        /*'#rename-topic {' +
            'display: block;' +
        '}' +*/
        '.statused tr:hover > .tcr .ipsModMenu, ' +
            '.forumline tr td:hover > .postdetails .ipsModMenu, ' +
            'ul.topiclist.topics.bg_none dl.icon:hover > .lastpost .ipsModMenu, '+
            'table.ipbtable tbody tr:hover > td.row1.lastaction .ipsModMenu{' +
            'visibility: visible;' +
        '}' +
        '.ipsModMenu {' +
            'background: url("http://i55.servimg.com/u/f55/18/17/62/92/modera10.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);' +
            'display: inline-block;' +
            'height: 15px;' +
            'margin: 0 8px;' +
            'text-indent: -2000em;' +
            'vertical-align: middle;' +
            'width: 15px;' +
            'float: right;' +
            'visibility: hidden;' +
            /*'margin-top: -6px;' +*/
        '}' +
        '.ipbmenu_content {' +
            'font-size: 12px;' +
            'min-width: 85px;' +
            'z-index: 2000;' +
        '}' +
        '.ipbmenu_content {' +
            'background-color: #F7F9FB;' +
            'border: 1px solid #D5DDE5;' +
            'box-shadow: 0 6px 6px rgba(0, 0, 0, 0.3);' +
        '}' +
        '.ipbmenu_content li:first-child {' +
            'padding-top: 0;' +
        '}' +
        '.ipbmenu_content li {' +
            'border-bottom: 1px solid #D5DDE5;' +
            'list-style-type: none !important;' +
        '}' +
        '.ipbmenu_content a {' +
            'display: block;' +
            'padding: 6px 10px;' +
            'text-align: left;' +
            'text-decoration: none;' +
        '}' +
        '.ipbmenu_content a:hover {' +
            'background: none repeat scroll 0 0 #D5DDE5;' +
        '}' +
        '.cancel {' +
            'color: #AD2930;' +
            'font-size: 0.9em;' +
            'font-weight: bold;' +
        '}' +
        '.input_text {' +
            'background: none repeat scroll 0 0 #FFFFFF !important;' +
            'border-color: #848484 #C1C1C1 #E1E1E1 !important;' +
            'border-radius: 2px 2px 2px 2px !important;' +
            'border-style: solid !important;' +
            'border-width: 1px !important;' +
            'padding: 4px !important;' +
            'font: 13px helvetica,arial,sans-serif !important;' +
        '}' +
        '#rename-topic .button2 {' +
            /*'border-color: #212121;' +
            'border-radius: 3px 3px 3px 3px;' +
            'box-shadow: 0 1px 0 0 #5C5C5C inset, 0 2px 3px rgba(0, 0, 0, 0.2);' +
            'border-style: solid;' +
            'border-width: 1px;' +*/
            'cursor: pointer;' +
            'padding: 4px 10px !important;' +
            'min-width: 0 !important;' +
            'font: 13px helvetica,arial,sans-serif !important;' +
        '}' +
        '.input_text:focus {' +
            'border-color: #4E4E4E #7C7C7C #A3A3A3;' +
            'box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);' +
        '}' +
        '#ipsGlobalNotification {' +
            'font-weight: bold;' +
            'left: 50%;' +
            'margin-left: -250px;' +
            'position: fixed;' +
            'text-align: center;' +
            'top: 20px;' +
            'z-index: 10000;' +
        '}' +
        '.popupWrapper {' +
            'background-color: rgba(70, 70, 70, 0.6);' +
            'border-radius: 4px 4px 4px 4px;' +
            'box-shadow: 0 12px 25px rgba(0, 0, 0, 0.7);' +
            'padding: 4px;' +
        '}' +
        '.popupInner {' +
            'background: none repeat scroll 0 0 #FFFFFF;' +
            'box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);' +
            'overflow-x: hidden;' +
            'overflow-y: auto;' +
            'width: 500px;' +
        '}' +
        '.ipsPad {' +
            'padding: 9px;' +
        '}' +
        '</style>',
    sTarget: '',
    sSearch: '',
    sExpression0: '',
    sExpression1: ''
};
/***
* User Definition Variables
***/
oMTConfig.sErrorMsg = 'Atenção!\n\n Ocorreu um erro ao editar o título, aguarde 10 segundos e tente novamente!';
oMTConfig.sSavingMsg = 'Atualizando o título do tópico, aguarde...';
oMTConfig.sDoneMsg = 'O título do tópico foi atualizado!';

window.onload = function() { //jQuery(function () {
    if (_userdata.user_level >= 1) {
        /* Forum versions! */
        var phpBB2 = jQuery('.bodyline');
        var phpBB3 = jQuery('#wrap');
        var punbb = jQuery('#pun-intro');
        var invision = jQuery('#ipbwrapper');

        if (phpBB2.length) {
            oMTConfig.sTarget = '.forumline td.row3Right span.postdetails';
            oMTConfig.sExpression0 = 'oClicked.parent().parent().parent().find("td a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#page-body .forumline .postbody:first", data).parents("tr:eq(1)").attr("id").split("p")[1];'
        } else if(phpBB3.length) {
            oMTConfig.sTarget = 'ul.topiclist.topics.bg_none dd.lastpost > span';
            oMTConfig.sExpression0 = 'oClicked.parent().parents("dl.icon").find("dd.dterm a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#main-content .post:first", data).attr("id").split("p")[1];';
        } else if(punbb.length) {
            oMTConfig.sTarget = '.statused td.tcr';
            oMTConfig.sExpression0 = 'oClicked.parents("tr").find(".tcl.tdtopics a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery(".posthead:first", data).attr("id").split("p")[1];';
        } else if(invision.length) {
            oMTConfig.sTarget = 'table.ipbtable tbody td.row1.lastaction';
            oMTConfig.sExpression0 = 'oClicked.parents("tr").find("td a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#main-content .borderwrap .post:first", data).attr("id").split("p")[1];';
        };

        jQuery(oMTConfig.sCSS).insertBefore('body');
        jQuery('body').append(oMTConfig.sInfo + oMTConfig.sMenu);
        jQuery(oMTConfig.sTarget).append(oMTConfig.sContent);

        jQuery('a.ipsModMenu').click(function () {
            var oClicked = jQuery(this);
            var oTarget = jQuery('#topic_mod_menucontent');

            if (oTarget[0].style.display == 'none') {
                oClicked.addClass('menu_active');

                oMTConfig.oTopicTitle = eval(oMTConfig.sExpression0);
                oMTConfig.sTopicHref = oMTConfig.oTopicTitle.attr('href');
                oMTConfig.iTopicID = oMTConfig.sTopicHref.substring(2, oMTConfig.sTopicHref.indexOf("-")); // .split(/[\/t-]/)[2]; <- More fast???
                oMTConfig.sTopicTitle = oMTConfig.oTopicTitle.text();

                var TID = jQuery('input[name="tid"]').val();

                jQuery('#t_lock').attr('href', '/modcp?mode=lock&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_move').attr('href', '/modcp?mode=move&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_hide').attr('href', '/modcp?mode=trash&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_delete').attr('href', '/modcp?mode=delete&t=' + oMTConfig.iTopicID  + '&tid=' + TID);

                oTarget
                    .css({
                        'left': (oClicked.offset().left + oClicked.outerWidth()) - oTarget.outerWidth(),
                        'top': oClicked.offset().top + oClicked.outerHeight()
                    })
                    .fadeIn(400);

                jQuery(document).mousedown(function() {
                    if(!oTarget.is(":hover")) {
                        jQuery(document).unbind('mousedown');
                        oClicked.removeClass('menu_active');
                        oTarget.fadeOut(400);
                    }
                });

            } else {
                oClicked.removeClass('menu_active');
                oTarget.fadeOut(400);
            }
            return false;
        });
    }
}; // });

function _rename_Topic() {
    oMTConfig.oTopicTitle.hide();
    var sHtml =
        '<span id="rename-topic">' +
         '<input type="text" maxlength="150" size="50" class="input_text" value="' + oMTConfig.sTopicTitle + '" id="rt_input" style="width: 56%; margin-right: 4px;">' +
            '<input type="submit" id="rt_submit" class="button2" value="Atualizar" onclick="_rt_commit()" style="margin-right: 4px;">' +
            '<a title="Cancelar" class="cancel" id="rt_cancel" href="#" onclick="jQuery(\'#rename-topic\').remove();oMTConfig.oTopicTitle.show();return false;">Cancelar</a>' +
      '</span>';
    oMTConfig.oTopicTitle.before(sHtml);

    jQuery('#rt_input').keydown(function (e){
        if(e.keyCode == 13 && jQuery('#rt_input').val() !== ''){
            _rt_commit();
        }
    });
}

function _rt_commit() {
    var iPostID = 0, user_Msg = '';
    var sNewTitle = jQuery('#rt_input').val();
    if (sNewTitle == '') return false;

    jQuery('body').append('<div id="ipsGlobalNotification"><div class="popupWrapper"><div class="popupInner"><div class="ipsPad">' + oMTConfig.sSavingMsg + '</div></div></div></div>');
    jQuery('#rename-topic').css('opacity', '0.4');

    jQuery.get(oMTConfig.sTopicHref, function(data) {
        iPostID = eval(oMTConfig.sExpression1);
    }).done(function(){
        jQuery.get("/post?p=" + iPostID + "&mode=editpost", function(data) {
            user_Msg = jQuery(data).find('#text_editor_textarea[name="message"]').val();
        }).done(function(){
            jQuery.post("/post?p=" + iPostID + "&mode=editpost", {
                subject: sNewTitle,
                message: user_Msg,
                edit_reason: '',
                attach_sig: '1',
                notify: "0",
                post: 1
            }).done(function(){
                jQuery('#ipsGlobalNotification').remove();
                jQuery('#rename-topic').remove();
                oMTConfig.oTopicTitle.show().text(sNewTitle);
                jQuery('body').append('<div id="ipsGlobalNotification"><div class="popupWrapper"><div class="popupInner"><div class="ipsPad">' + oMTConfig.sDoneMsg + '</div></div></div></div>');
                setTimeout(function() {
                    jQuery('#ipsGlobalNotification').remove();
                }, 4000);
            }).fail(function(){
                jQuery('#ipsGlobalNotification').remove();
                oMTConfig.oTopicTitle.show();
                alert(oMTConfig.sErrorMsg);
            });
        }).fail(function(){
            jQuery('#ipsGlobalNotification').remove();
            oMTConfig.oTopicTitle.show();
            alert(oMTConfig.sErrorMsg);
        });
    }).fail(function(){
        jQuery('#ipsGlobalNotification').remove();
        oMTConfig.oTopicTitle.show();
        alert(oMTConfig.sErrorMsg);
    });
}

Result:
Application: Actions of moderation Captur13

Another code that I made more than a year, I know he's too fat and needs an overhaul!!!

JS


Last edited by JScript on July 2nd 2015, 6:12 pm; edited 1 time in total (Reason for editing : Remove the word "undefined"!)
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Van-Helsing July 2nd 2015, 2:32 am

Another perfect code congratulations JScript.
~1~
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by SLGray July 2nd 2015, 3:24 am

I can say this will work on an Invsion forum.


Application: Actions of moderation Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51552
Reputation : 3523
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by darki July 2nd 2015, 5:58 pm

After installing this, the word "undefined" appears on the right of the avatars in the list of topics.
@JScript
avatar
darki
Forumember

Posts : 254
Reputation : 10
Language : German, english

http://schiggysboard.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by JScript July 2nd 2015, 6:14 pm

@darki
Try again, the code has been fixed, thanks!

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by darki July 2nd 2015, 6:27 pm

It's working, but
Destacar tópico and Fechar tópico won't display because of "//" in front of the <li style> tag. After deleting the "//" both don't work. Are the "//" deliberately made because of the fact that the two things don't work?
Also: Reciclar (Ocultar) - what is that?

Thank you for answering.
avatar
darki
Forumember

Posts : 254
Reputation : 10
Language : German, english

http://schiggysboard.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by JScript July 2nd 2015, 6:33 pm

@darki
These and most other items only in the next version, thank you.

JS
JScript
JScript
Forumember

Male Posts : 741
Reputation : 175
Language : PT-BR, EN
Location : Brazil

http://jscript.forumeiros.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by darki July 2nd 2015, 6:49 pm

Before installing:
Application: Actions of moderation Hghjk10

After installing:
Application: Actions of moderation Hbmnm10

You see, it's getting bigger. It is possible by editing the css that it won't get bigger? If yes, would you do that?
avatar
darki
Forumember

Posts : 254
Reputation : 10
Language : German, english

http://schiggysboard.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Milouze14 October 1st 2015, 7:08 pm

Hi JScript , thank you for the work done, sorry for my English but I Francaisdonc I will try to be as clear as possible, I have 4 phppp2 forums, phpbb3, and Invision punbb and forums on these 4 the word "undefined" is present footer left.
Thank you a lot.
Milouze14.
a ++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Ange Tuteur October 6th 2015, 4:02 pm

Hi @Milouze14,

JScript is currently absent, but I'll see if I can figure out the problem. Where is "undefined" displaying ? Could you provide me an example, maybe an image ? That should help me understand where I need to look. Smile

Thanks, and have a good day. ^^
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Milouze14 October 6th 2015, 4:21 pm

Hi Ange Tuteur Wink ,

The script is placed on forums and here in an image and bottom of the page
we distinguish the words "undefined" :

Application: Actions of moderation 0120

thank you a lot.

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Ange Tuteur October 6th 2015, 4:30 pm

Ooooh I didn't notice that ! Shocked

I think I see where the problem is coming from. sInfo isn't defined inside oMTConfig so it returns "undefined" when added to the body. Find and remove this part in the script :
Code:
oMTConfig.sInfo +
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Milouze14 October 6th 2015, 4:36 pm

Ho you're really great,
thank you again for all the work done thumleft .
thank you a lot Ange Tuteur Wink .

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Joost October 6th 2015, 6:01 pm

This nice moderation tool does not work on my PhpBB3 forum.. Sad
Joost
Joost
Active Poster

Male Posts : 1406
Reputation : 194
Language : Dutch, English
Location : The Netherlands

https://ondersteun.actieforum.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Milouze14 October 7th 2015, 7:44 am

Hi Joost,
I had the same worries about one of my forums and widgets come into conflict,
we must find a solution which, and to display it differently.

a++
Milouze14
Milouze14
Forumember

Male Posts : 59
Reputation : 18
Language : French
Location : Vendée

http://www.milouze14.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Beyonder October 7th 2015, 7:58 am

Whats this for?
Beyonder
Beyonder
Forumember

Male Posts : 726
Reputation : 29
Language : English
Location : Beyond Realm

http://fictionalomniverse.forumotion.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Zed is Not Dead October 7th 2015, 9:39 am

Hello @hagoromo Otsutsuki ,  I am well aware I am not JScript but I can pretty much summarize the purpose of this code.  This code makes it easier for staff members such as moderators or administrators to edit topic name, delete thread, move thread, or move to trash, without having to click on the thread itself.  So in other words it is a quick tool in a sense. The way this works is you click on the link you would on the forum that hyperlinks you to the sub forum then you hover the mouse to the right of the sub forum and a gear should appear, you click the gear and you have the option of Edit Thread Name, Delete Thread, Move Thread, Trash Thread, and Lock Thread.  This is quick easy and efficient as some staff members don't like to go into a thread edit, delete, move, trash then exit out and rinse and repeat, this method simply does it all in one go, and is perfect for organization, I have this code on the forum I work with and I love it.
Zed is Not Dead
Zed is Not Dead
Forumember

Posts : 257
Reputation : 28
Language : English

http://naruto-ld.forumotion.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by SarkZKalie February 26th 2016, 10:44 am

I wish your all scripts can be add to Forumotion forums as one of available options Very Happy
What a great code, Sir!
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1443
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Rukiafan March 6th 2016, 7:09 pm

@JScript I don't know why, but your code didn't work for me and to make matters worse it somehow caused my forum's index template to be lost, which makes no sense given that they're separate from one-another, I know, but it actually happened...

@Ange Tuteur What could have caused the issue? I wouldn't think that JS could possibly cause a template to just return to its default settings like that?! scratch
Rukiafan
Rukiafan
Forumember

Posts : 329
Reputation : 9
Language : English

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Poser April 16th 2016, 8:43 am

Sorry to revive but can someone translate the moderation tools in this script? I hope to see it in English. It appears like it's Portuguese or Spanish (I think?)
Poser
Poser
Helper
Helper

Male Posts : 413
Reputation : 43
Language : English, Filipino
Location : @ohmpawatt

http://maristpress.forumotion.com/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Take Notes April 16th 2016, 3:02 pm

Create a support topic and I can assist you there.
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by brandon_g April 16th 2016, 3:09 pm

Forumedic wrote:Create a support topic and I can assist you there.

You can assist him here actually, since this is in the community analasis zone, meaning we are not required to provide support for the script, however, if you want to help him, you can do so in this topic, no need to have him create a new support topic. Wink

-Brandon


Application: Actions of moderation Brando10
Remember to mark your topic Application: Actions of moderation Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Application: Actions of moderation Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 10113
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Take Notes April 16th 2016, 3:19 pm

English version:
Code:

var oMTConfig = {
    sErrorMsg: '',
    oTopicTitle: {},
    sTopicHref: '',
    iTopicID: 0,
    sTopicTitle: '',
    sContent:
        '<a title="Moderation Actions" class="ipsModMenu" href="#">&nbsp;</a>',
    sMenu:
        '<ul style="display: none; position: absolute; z-index: 9999;" class="ipbmenu_content" id="topic_mod_menucontent">' +
            '<li style="z-index: 10000;"><a title="rename Topic" href="" id="t_rename" onclick="_rename_Topic();return false;" style="z-index: 10000;">Rename Topic</a></li>' +
            //'<li style="z-index: 10000;"><a title="Highlight Topic" href="" id="t_pin" style="z-index: 10000;">Highlight Topic</a></li>' +
            //'<li style="z-index: 10000;"><a title="Change Icon" href="" id="t_icon" style="z-index: 10000;">Change Icon</a></li>' +
            '<li style="z-index: 10000;"><a title="Close Topic" href="" id="t_lock" style="z-index: 10000;">Close Topic</a></li>' +
            '<li style="z-index: 10000;"><a title="Move Topic" href="" id="t_move" style="z-index: 10000;">Move Topic</a></li>' +
            '<li style="z-index: 10000;"><a title="Trash Topic" href="" id="t_hide" style="z-index: 10000;">Recycle Topic</a></li>' +
            '<li style="z-index: 10000;"><a title="Delete Topic" href="" id="t_delete" style="z-index: 10000;">Delete Topic</a></li>' +
        '</ul>',
    sCSS:
        '<style>' +
        /*'#rename-topic {' +
            'display: block;' +
        '}' +*/
        '.statused tr:hover > .tcr .ipsModMenu, ' +
            '.forumline tr td:hover > .postdetails .ipsModMenu, ' +
            'ul.topiclist.topics.bg_none dl.icon:hover > .lastpost .ipsModMenu, '+
            'table.ipbtable tbody tr:hover > td.row1.lastaction .ipsModMenu{' +
            'visibility: visible;' +
        '}' +
        '.ipsModMenu {' +
            'background: url("http://i55.servimg.com/u/f55/18/17/62/92/modera10.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);' +
            'display: inline-block;' +
            'height: 15px;' +
            'margin: 0 8px;' +
            'text-indent: -2000em;' +
            'vertical-align: middle;' +
            'width: 15px;' +
            'float: right;' +
            'visibility: hidden;' +
            /*'margin-top: -6px;' +*/
        '}' +
        '.ipbmenu_content {' +
            'font-size: 12px;' +
            'min-width: 85px;' +
            'z-index: 2000;' +
        '}' +
        '.ipbmenu_content {' +
            'background-color: #F7F9FB;' +
            'border: 1px solid #D5DDE5;' +
            'box-shadow: 0 6px 6px rgba(0, 0, 0, 0.3);' +
        '}' +
        '.ipbmenu_content li:first-child {' +
            'padding-top: 0;' +
        '}' +
        '.ipbmenu_content li {' +
            'border-bottom: 1px solid #D5DDE5;' +
            'list-style-type: none !important;' +
        '}' +
        '.ipbmenu_content a {' +
            'display: block;' +
            'padding: 6px 10px;' +
            'text-align: left;' +
            'text-decoration: none;' +
        '}' +
        '.ipbmenu_content a:hover {' +
            'background: none repeat scroll 0 0 #D5DDE5;' +
        '}' +
        '.cancel {' +
            'color: #AD2930;' +
            'font-size: 0.9em;' +
            'font-weight: bold;' +
        '}' +
        '.input_text {' +
            'background: none repeat scroll 0 0 #FFFFFF !important;' +
            'border-color: #848484 #C1C1C1 #E1E1E1 !important;' +
            'border-radius: 2px 2px 2px 2px !important;' +
            'border-style: solid !important;' +
            'border-width: 1px !important;' +
            'padding: 4px !important;' +
            'font: 13px helvetica,arial,sans-serif !important;' +
        '}' +
        '#rename-topic .button2 {' +
            /*'border-color: #212121;' +
            'border-radius: 3px 3px 3px 3px;' +
            'box-shadow: 0 1px 0 0 #5C5C5C inset, 0 2px 3px rgba(0, 0, 0, 0.2);' +
            'border-style: solid;' +
            'border-width: 1px;' +*/
            'cursor: pointer;' +
            'padding: 4px 10px !important;' +
            'min-width: 0 !important;' +
            'font: 13px helvetica,arial,sans-serif !important;' +
        '}' +
        '.input_text:focus {' +
            'border-color: #4E4E4E #7C7C7C #A3A3A3;' +
            'box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);' +
        '}' +
        '#ipsGlobalNotification {' +
            'font-weight: bold;' +
            'left: 50%;' +
            'margin-left: -250px;' +
            'position: fixed;' +
            'text-align: center;' +
            'top: 20px;' +
            'z-index: 10000;' +
        '}' +
        '.popupWrapper {' +
            'background-color: rgba(70, 70, 70, 0.6);' +
            'border-radius: 4px 4px 4px 4px;' +
            'box-shadow: 0 12px 25px rgba(0, 0, 0, 0.7);' +
            'padding: 4px;' +
        '}' +
        '.popupInner {' +
            'background: none repeat scroll 0 0 #FFFFFF;' +
            'box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);' +
            'overflow-x: hidden;' +
            'overflow-y: auto;' +
            'width: 500px;' +
        '}' +
        '.ipsPad {' +
            'padding: 9px;' +
        '}' +
        '</style>',
    sTarget: '',
    sSearch: '',
    sExpression0: '',
    sExpression1: ''
};
/***
* User Definition Variables
***/
oMTConfig.sErrorMsg = 'There was an error, please try again in 10 seconds!!';
oMTConfig.sSavingMsg = 'Update pending, please wait...';
oMTConfig.sDoneMsg = 'The topic title has been updated!';
 
window.onload = function() { //jQuery(function () {
    if (_userdata.user_level >= 1) {
        /* Forum versions! */
        var phpBB2 = jQuery('.bodyline');
        var phpBB3 = jQuery('#wrap');
        var punbb = jQuery('#pun-intro');
        var invision = jQuery('#ipbwrapper');
 
        if (phpBB2.length) {
            oMTConfig.sTarget = '.forumline td.row3Right span.postdetails';
            oMTConfig.sExpression0 = 'oClicked.parent().parent().parent().find("td a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#page-body .forumline .postbody:first", data).parents("tr:eq(1)").attr("id").split("p")[1];'
        } else if(phpBB3.length) {
            oMTConfig.sTarget = 'ul.topiclist.topics.bg_none dd.lastpost > span';
            oMTConfig.sExpression0 = 'oClicked.parent().parents("dl.icon").find("dd.dterm a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#main-content .post:first", data).attr("id").split("p")[1];';
        } else if(punbb.length) {
            oMTConfig.sTarget = '.statused td.tcr';
            oMTConfig.sExpression0 = 'oClicked.parents("tr").find(".tcl.tdtopics a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery(".posthead:first", data).attr("id").split("p")[1];';
        } else if(invision.length) {
            oMTConfig.sTarget = 'table.ipbtable tbody td.row1.lastaction';
            oMTConfig.sExpression0 = 'oClicked.parents("tr").find("td a.topictitle");';
            oMTConfig.sExpression1 = 'jQuery("#main-content .borderwrap .post:first", data).attr("id").split("p")[1];';
        };
 
        jQuery(oMTConfig.sCSS).insertBefore('body');
        jQuery('body').append(oMTConfig.sInfo + oMTConfig.sMenu);
        jQuery(oMTConfig.sTarget).append(oMTConfig.sContent);
 
        jQuery('a.ipsModMenu').click(function () {
            var oClicked = jQuery(this);
            var oTarget = jQuery('#topic_mod_menucontent');
 
            if (oTarget[0].style.display == 'none') {
                oClicked.addClass('menu_active');
 
                oMTConfig.oTopicTitle = eval(oMTConfig.sExpression0);
                oMTConfig.sTopicHref = oMTConfig.oTopicTitle.attr('href');
                oMTConfig.iTopicID = oMTConfig.sTopicHref.substring(2, oMTConfig.sTopicHref.indexOf("-")); // .split(/[\/t-]/)[2]; <- More fast???
                oMTConfig.sTopicTitle = oMTConfig.oTopicTitle.text();
 
                var TID = jQuery('input[name="tid"]').val();
 
                jQuery('#t_lock').attr('href', '/modcp?mode=lock&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_move').attr('href', '/modcp?mode=move&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_hide').attr('href', '/modcp?mode=trash&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
                jQuery('#t_delete').attr('href', '/modcp?mode=delete&t=' + oMTConfig.iTopicID  + '&tid=' + TID);
 
                oTarget
                    .css({
                        'left': (oClicked.offset().left + oClicked.outerWidth()) - oTarget.outerWidth(),
                        'top': oClicked.offset().top + oClicked.outerHeight()
                    })
                    .fadeIn(400);
 
                jQuery(document).mousedown(function() {
                    if(!oTarget.is(":hover")) {
                        jQuery(document).unbind('mousedown');
                        oClicked.removeClass('menu_active');
                        oTarget.fadeOut(400);
                    }
                });
 
            } else {
                oClicked.removeClass('menu_active');
                oTarget.fadeOut(400);
            }
            return false;
        });
    }
}; // });
 
function _rename_Topic() {
    oMTConfig.oTopicTitle.hide();
    var sHtml =
        '<span id="rename-topic">' +
         '<input type="text" maxlength="150" size="50" class="input_text" value="' + oMTConfig.sTopicTitle + '" id="rt_input" style="width: 56%; margin-right: 4px;">' +
            '<input type="submit" id="rt_submit" class="button2" value="Atualizar" onclick="_rt_commit()" style="margin-right: 4px;">' +
            '<a title="Cancelar" class="cancel" id="rt_cancel" href="#" onclick="jQuery(\'#rename-topic\').remove();oMTConfig.oTopicTitle.show();return false;">Cancelar</a>' +
      '</span>';
    oMTConfig.oTopicTitle.before(sHtml);
 
    jQuery('#rt_input').keydown(function (e){
        if(e.keyCode == 13 && jQuery('#rt_input').val() !== ''){
            _rt_commit();
        }
    });
}
 
function _rt_commit() {
    var iPostID = 0, user_Msg = '';
    var sNewTitle = jQuery('#rt_input').val();
    if (sNewTitle == '') return false;
 
    jQuery('body').append('<div id="ipsGlobalNotification"><div class="popupWrapper"><div class="popupInner"><div class="ipsPad">' + oMTConfig.sSavingMsg + '</div></div></div></div>');
    jQuery('#rename-topic').css('opacity', '0.4');
 
    jQuery.get(oMTConfig.sTopicHref, function(data) {
        iPostID = eval(oMTConfig.sExpression1);
    }).done(function(){
        jQuery.get("/post?p=" + iPostID + "&mode=editpost", function(data) {
            user_Msg = jQuery(data).find('#text_editor_textarea[name="message"]').val();
        }).done(function(){
            jQuery.post("/post?p=" + iPostID + "&mode=editpost", {
                subject: sNewTitle,
                message: user_Msg,
                edit_reason: '',
                attach_sig: '1',
                notify: "0",
                post: 1
            }).done(function(){
                jQuery('#ipsGlobalNotification').remove();
                jQuery('#rename-topic').remove();
                oMTConfig.oTopicTitle.show().text(sNewTitle);
                jQuery('body').append('<div id="ipsGlobalNotification"><div class="popupWrapper"><div class="popupInner"><div class="ipsPad">' + oMTConfig.sDoneMsg + '</div></div></div></div>');
                setTimeout(function() {
                    jQuery('#ipsGlobalNotification').remove();
                }, 4000);
            }).fail(function(){
                jQuery('#ipsGlobalNotification').remove();
                oMTConfig.oTopicTitle.show();
                alert(oMTConfig.sErrorMsg);
            });
        }).fail(function(){
            jQuery('#ipsGlobalNotification').remove();
            oMTConfig.oTopicTitle.show();
            alert(oMTConfig.sErrorMsg);
        });
    }).fail(function(){
        jQuery('#ipsGlobalNotification').remove();
        oMTConfig.oTopicTitle.show();
        alert(oMTConfig.sErrorMsg);
    });
}
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by Abdalah_98 May 16th 2016, 8:24 am

Big thanks to big code !

it's worked PUNBB with no problem

But how to add ( stick topic ,.. ) action ?
Abdalah_98
Abdalah_98
Forumember

Male Posts : 32
Reputation : 1
Language : EN,AR
Location : Earth :D

http://uteach.forum0.net/

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by omarpop23 June 16th 2016, 3:53 am

works Good with me on PhpBB3
omarpop23
omarpop23
Forumember

Male Posts : 182
Reputation : 3
Language : Arabic
Location : Egypt

http://devs.ahlamontada.com

Back to top Go down

Application: Actions of moderation Empty Re: Application: Actions of moderation

Post by SLGray February 23rd 2017, 8:00 am

This will no longer be supported by JScript: https://help.forumotion.com/t151137-in-memory-of-jscript-joao-carlos.


Application: Actions of moderation Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51552
Reputation : 3523
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum