News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1194938720:v:use_geshi-1:v:type-javascript

Started by Guest, Nov 13, 2007, 07:25 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Guest

// ==UserScript==
// @name          SMF Convert Dropdown
// @namespace     http://www.jaybachatero.com/
// @description   Shows a drop down of convert topics.
// @include       http://simplemachines.org/community/index.php?topic*
// @include       http://www.simplemachines.org/community/index.php?topic*
// @include       http://simplemachines.org/community/index.php?action=post*
// @include       http://www.simplemachines.org/community/index.php?action=post*
// ==/UserScript==

function smfConverters()
{
   // This is offset in pixels for witdh and height.  Change this to make it work with your screen resolution
   var widthOffset = 230;
   var heightOffset = 140;

   var scripturl = \"http://www.simplemachines.org/community/index.php\";
   var message = \"Try using the converter in this topic: \";
   var bodyheight = document.body.scrollHeight - heightOffset;

   // Categories to show.
   var converters = new Array(
      [000000, \'Select One\'],
      [140741, \'Convert.php\'],
      [141395, \'e107 0.7.7\'],
      [146211, \'IPB 1.3.x\'],
      [145284, \'IPB 2.2.x\'],
      [145191, \'MyBB 1.2.x\'],
      [142124, \'phpBB 2.0.19+\'],
      [145652, \'SimpleBoard 1.0 & 1.1\'],
      [140744, \'XMB 1.9.6\'],
      [146308, \'XOOPS & newBB 2\'],
      [122338, \'YaBB 2.1\'],
      [140776, \'YaBB SE 1.5.4\']
   );

   var dropdownShow = document.createElement(\'div\');
   var dropdownList = \'<div style=\"font-size: x-small; position: absolute; z-index: 1; left: \' + widthOffset + \'px; top: \' + bodyheight + \'px;\" id=\"convertdiv\"><select name=\"dropdown\" onchange=\"if (!this.value) return; replaceText(this.value, document.forms.postmodify.message); return false;\">\';

   for (var i in converters)
   {
      dropdownList += \'<option value=\"\' + message + \'[0] + \']\' + converters[1] + \'\" \' + (converters[0] == \'000000\' ? \'disabled=\"disabled\" selected=\"selected\"\' : \'\') + \'>\' + converters[1] + \'</option>\';
   }

   // Close it
   dropdownList += \'</select></div>\';

   // Show it
   dropdownShow.innerHTML = dropdownList;
   document.body.insertBefore(dropdownShow, document.body.lastChild);
}
smfConverters();