User:Dtrebbien/monobook.js

Hello, you have come here looking for the meaning of the word User:Dtrebbien/monobook.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Dtrebbien/monobook.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Dtrebbien/monobook.js in singular and plural. Everything you need to know about the word User:Dtrebbien/monobook.js you have here. The definition of the word User:Dtrebbien/monobook.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Dtrebbien/monobook.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
/**
 * Based on TheDJ's HotCat script (http://en.wikipedia.orghttps://dictious.com/en/User:TheDJ/Gadget-HotCat.js), this
 * places links for commonly-added Categories in the Categories section, which, when clicked, will add the
 * category to the current page.
 *
 * @author Magnus Manske, TheDJ, D. Trebbien
 * @last-modified 2008-August-23
 */
var common_normal_categories = new Array (
  "Words on Korpusbasierte Wortgrundformenliste DeReWo, v-30000g-2007-12-31-0.1"
);

function addCategory(cat) {
  //window.alert(cat);
  var url = document.getElementById('ca-edit').getElementsByTagName('a').href
    + "&hotcat_newcat=" + encodeURIComponent( cat ) ;
  document.location = url ;
}

function getParameter(name) {
  var cmdRe=RegExp(''+name+'=(*)');
  var m=cmdRe.exec(document.location.href);
  if (m) {
    try {
      return decodeURIComponent(m);
    } catch (e) {}
  }
  return null;
}

// New. Code by Lupo & Superm401, added by Lupo, 2008-02-2007
function hotcat_find_category (wikitext, category)
{
  var cat_name  = category.replace(/()/g, "\\$1");
  var initial   = cat_name.substr (0, 1);
  var cat_regex = new RegExp ("\\ategory\\s*:\\s*"
                              + (initial == "\\"
                                 ? initial
                                 : "")
                              + cat_name.substring (1).replace (//g, "")
                              + "\\s*(\\|.*?)?\\]\\]", "g"
                             );
  var result = new Array ();
  var curr_match  = null;
  while ((curr_match = cat_regex.exec (wikitext)) != null) {
    result  = {match : curr_match};
  }
  return result; // An array containing all matches, with positions, in result.match
}

// New. Code by TheDJ, 2008-03-12
function hotcat_find_ins ( wikitext )
{
  var re = /\]+\]\]/ig
  var index = -1;
  while( re.exec(wikitext) != null ) index = re.lastIndex;
 
  if( index > -1) return index;
  //we should try to find interwiki links here, but that's for later.
 
  return -1;
}

$(function() {
  var cat_add = getParameter("hotcat_newcat");
  if(cat_add != null && cat_add.length > 0) {
    var t = document.editform.wpTextbox1.value ;
    var summary = new Array () ;
    var ret = 0;

    var matches = hotcat_find_category (t, cat_add);
    if (matches && matches.length > 0) {
      alert ('Category "' + cat_add + '" already exists; not added.');
      //prevent_autocommit = 1;
    } else {
      var insertionpoint = hotcat_find_ins( t );
      var newcatstring = '\n\\]';
      if( insertionpoint > -1 ) {
        t = t.substring(0, insertionpoint ) + newcatstring + t.substring( insertionpoint );
      } else {
        t = t + newcatstring;
      }
      summary.push ( "Quick-adding category \"" + cat_add + "\"" ) ;
      var t2 = t.replace(/\{\{ncategorized*\}\}/g, ""); // Remove "uncategorized" template
      if (t2.length != t.length) {
        t = t2;
        summary.push ( "removed {{uncategorized}}" ) ;
      }
      ret = 1;
    }
    if (ret) {
      document.editform.wpTextbox1.value = t ;
      document.editform.wpSummary.value = summary.join( "; " )
                                        + " (using ])" ;
      document.editform.wpMinoredit.checked = true ;
      //if (!prevent_autocommit) {
        // Hide the entire edit section so as not to tempt the user into editing...
        var bodyContentId = document.getElementById("bodyContent") || document.getElementById("mw_contentholder");
        bodyContentId.style.display = "none";
        document.editform.submit();
      //}
    }
    return;
  }

  if( wgAction != "view" || document.getElementById('ca-viewsource' ) != null ||
      wgNamespaceNumber == -1 || wgNamespaceNumber == 10 )
    return;
 
  // If we have no Categories div, then add one
  // TheDJ, 2008-02-28
 
  var normal_catlinks = document.getElementById ('mw-normal-catlinks');
  var hidden_catlinks = document.getElementById ('mw-hidden-catlinks');
 
  if ( normal_catlinks == null || typeof( normal_catlinks ) == 'undefined' ) {
    d3 = document.createElement ( "div" );
    d3.id = "mw-normal-catlinks";
    d3.innerHTML = '<a href="https://dictious.com/en/Special:Categories" title="Special:Categories">Categories</a>: ';
    normal_catlinks = d3;
 
    if ( hidden_catlinks ) {
      // There are hidden categories.
      hidden_catlinks.parentNode.insertBefore( d3, hidden_catlinks );
      hidden_catlinks.parentNode.className = "catlinks";
    } else {
      // This page has no categories at all, let's create a section where we can add them.
      var footer = getElementsByClassName ( document , "div" , "printfooter" ) ;
      if( !footer ) return; // We have no idea where we should add this.
 
      d1 = document.createElement ( "div" );
      d1.id = "catlinks";
      d1.className = "catlinks";
      d1.appendChild ( d3 );
      footer.parentNode.insertBefore( d1, footer.nextSibling );
    } 
  }

  for(var i in common_normal_categories) {
    var sep = document.createElement ( "br" ) ;
    normal_catlinks.appendChild ( sep ) ;

    var cat = common_normal_categories;
    var a = document.createElement ( "a" ) ;
    a.href = "javascript:addCategory('" + cat + "');";
    a.innerHTML = "+ " + cat;
    a.style.color = "#800080";
    //a.class = "";
    normal_catlinks.appendChild ( a ) ;
  }
});