SleePyCode Forums

Special Site & Other Boards => PasteBin => Topic started by: Guest on Nov 13, 2007, 07:25 AM

Title: Paste-1194938720:v:use_geshi-1:v:type-javascript
Post by: Guest on Nov 13, 2007, 07:25 AM
// ==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 + \' (//%5C'%20+%20scripturl%20+%20%5C'?topic=%5C'%20+%20converters%5Bi)