mozillaZine Forums - inserts titles to bug links

Inserts titles to bug links that are plain URLs, in forums.mozillazine.org

La data de 04-09-2015. Vezi ultima versiune.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        mozillaZine Forums - inserts titles to bug links
// @author      darkred
// @description Inserts titles to bug links that are plain URLs, in forums.mozillazine.org
// @include     http://forums.mozillazine.org/viewtopic.php*
// @version     1.1
// @grant			  GM_xmlhttpRequest
// @namespace rikkie
// ==/UserScript==

var items = [];
var links = document.getElementsByClassName('postlink');


for (i = 0; i < links.length; i++) {
  if (links[i].innerHTML.match(/https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=*/)) {

    var elem = document.createElement("img");
    elem.setAttribute("src", "http://i.imgur.com/3Y8dqYZ.gif");
    links[i].parentNode.insertBefore(elem, links[i].nextSibling);
    
    
    
    insertTitle(links[i]);
  };
};


function insertTitle(x) {
  var details = GM_xmlhttpRequest({
    method: 'GET',
    url: x.innerHTML,
    synchronous: false,                         // Asynchronous request
    onload: function (response) {      
      var matches = response.responseText.match(/<title>(.*)<\/title>/);
      var regex = /<title>(.*)<\/title>/;
      var title = regex.exec(matches[0]);
      x.nextSibling.remove();
      x.innerHTML = title[1];
    }
  })
}