User:Yair rand/addimage.js

Hello, you have come here looking for the meaning of the word User:Yair rand/addimage.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Yair rand/addimage.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Yair rand/addimage.js in singular and plural. Everything you need to know about the word User:Yair rand/addimage.js you have here. The definition of the word User:Yair rand/addimage.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Yair rand/addimage.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
if(wgNamespaceNumber == 0 && wgAction == "view" && !/&printable=yes|&diff=|&oldid=/.test(window.location.search))
{
  addOnloadHook(function()
  {
    bodyContent = document.getElementById('bodyContent');
    mw.util.addPortletLink('p-tb', 'javascript:addImage()', 'Add image', 'newimagebutton');
  });
}


var addingImage = 0;


function addImage()
{
  if(! document.onmousemove && addingImage == 0)
  {
    addingImage = 1;

    var adderObject =
      {
        createForm:
          function ()
          {
            return(
              newNode
              (
                'form',
                { style: 'float:right' },
                newNode
                (
                  'table',
                  newNode
                  (
                    'tbody',
                    newNode
                    (
                      'tr',
                      newNode('td', 'File name:'),
                      newNode('td', temp = newNode('input',{'name':'filename'}))
                    ),
                    newNode
                    (
                      'tr',
                      newNode('td', 'Caption: '),
                      newNode('td', newNode('input', {'name':'caption'}))
                    ),
                    newNode
                    (
                      'tr',
                      newNode
                      (
                        'td',
                        { colspan: 2, align: 'center' },
                        newNode('input', {type: 'submit', value: 'Place'})
                      )
                    )
                  )
                )
              )
            );
          },
        fields:
          {
            'filename':
              function (txt, error)
                { return util.validateNoWikisyntax('filename', true)(txt, error); },
            'caption':
              function (txt, error)
              {
                if(txt)
                  { return txt; }
                else
                  { return error("Please specify a caption."); }
              }
          },
        onsubmit:
          function(values, render)
          {
            render
            (
              ']',
               function (newhtml)
                 { addImage2(values.filename, values.caption, newhtml); }
            );
            bodyContent.removeChild(bodyContent.firstChild);
          }
      };

    new AdderWrapper(new Editor(), adderObject, bodyContent, bodyContent.firstChild);
    temp.focus();
  }
}

function addImage2(q, qq, newBoxHtml)
{
  if(! document.onmousemove)
  {
    currentBoxToBeAdded =
    (
      newNode
      (
        'div',
        { style: 'position:fixed;left:0px;top:0px;z-index:5;' }
      )
    );

    currentBoxToBeAdded.innerHTML = newBoxHtml;
    setUpBoxToBeAdded();

    for(var z = 2; z <= 5; z++)
    {
      var y = bodyContent.getElementsByTagName('h' + z);
      for(var x = 0; x < y.length; x++)
      {
        y.onmouseover =
          function ()
          {
            this.parentNode.insertBefore(currentBoxToBeAdded, this.nextSibling);
            currentBoxToBeAdded.style.position = '';
          }
      }
    }

    document.body.onclick =
      function ()
      {
        if(! currentBoxToBeAdded.style.position)
          addImage3(q,qq,currentBoxToBeAdded.previousSibling);
      }
  }
}

function addImage3(q,qq,qqq)
{
  for(var z = 2; z <= 6; z++)
  {
    var y = document.getElementsByTagName('h' + z);
    for(var x = 0; x < y.length; x++)
    {
      y.onmouseover = null;
    }
  }

  document.body.onclick = null;
  document.onmousemove = null;
  document.body.style.cursor = '';
  addingImage = 0;
  var qqqq = currentBoxToBeAdded.firstChild;
  currentBoxToBeAdded.removeChild(qqqq);
  currentBoxToBeAdded.parentNode.removeChild(currentBoxToBeAdded);


  function addImage4(wikitext)
  {
    var findNumberOfHeaders =
      Number(qqq.firstChild.getElementsByTagName('a').href.match(/\d*$/));
    wikitext =
    (
      wikitext.replace
      (
        new RegExp
        (
          "((?:(^|\n)=*?){" + findNumberOfHeaders + "}*?)\n"
        ),
        '$1\n]\n'
      )
    );
    ccc = wikitext;
    return wikitext;
  }

  var editor = new Editor();
  editor.addEdit({
              edit: addImage4,
              redo: function () { qqq.parentNode.insertBefore(qqqq,qqq.nextSibling); },
              undo: function () { qqqq.parentNode.removeChild(qqqq); },
              summary: "+]"
          },qqqq);
}