User:DatRoot/Scripts/LogLink.js

/* Adds a link to the toolbox to display the logs for a page. To remove ambiguity, it renames the existing link titled "Logs" that appears on user pa

/*
Adds a link to the toolbox to display the logs for a page.
To remove ambiguity, it renames the existing link titled "Logs" that appears 
on user pages to "User logs".
Though both titles can be changed using:
    DatRoot.LogLink.pageLogTitle = "Logs";
    DatRoot.LogLink.userLogTitle = "User logs";
By default the link is added before the link "What links here". 
To add before a different link use:
    DatRoot.LogLink.addBefore = 
Supplying the id of the element;
*/

importScript("User:DatRoot/Scripts/Common.js");

$(function(){ DatRoot.LogLink = function()
{
    var obj = {};
    
    if(wgNamespaceNumber >= 0) DatRoot.addOnloadHook(function()
    {
        var refElem = document.getElementById(obj.addBefore) 
            || document.getElementById("t-whatlinkshere");
        if(refElem)
        {
            // Add the new log link before given element
            var htmlStrings = [
                '<a', ' title="View the list of actions to this page"',
                ' href="/w/index.php?title=Special:Log&page=', wgPageName, '"',
                '>', obj.pageLogTitle, '</a>' ];
            var logLink = DatRoot.createElement("li", "t-pagelog", "", htmlStrings.join(""));
            refElem.parentNode.insertBefore(logLink, refElem);
        }
        
        // If logs link for user exists, rename to "User logs"
        var userLogLink = document.getElementById("t-log");
        if(userLogLink) userLogLink.firstChild.innerHTML = obj.userLogTitle;
    });
        
    obj.addBefore = "t-whatlinkshere";
    obj.pageLogTitle = "Logs";
    obj.userLogTitle = "User logs";
    
    
    return obj;
}();});

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.