User:Yair rand/DiscussionSandbox.js

Hello, you have come here looking for the meaning of the word User:Yair rand/DiscussionSandbox.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Yair rand/DiscussionSandbox.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Yair rand/DiscussionSandbox.js in singular and plural. Everything you need to know about the word User:Yair rand/DiscussionSandbox.js you have here. The definition of the word User:Yair rand/DiscussionSandbox.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Yair rand/DiscussionSandbox.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
$(function($){
  $("#discussionstartbutton").click(function(e){
    e.preventDefault();
    $(this).append($("<div>").css({"text-align":"left","padding":"7px"}).append(
      "Title: ", 
      $("<input>").css("width","80%"), 
      $("<textarea>").attr("rows","6"),
      $("<button>").append("Save").click(function(){
        var a = $(this.parentNode).find("input").val(), b = $(this.parentNode).find("textarea").val(), c = 2;
        if( !a || !b ){return}
        document.body.style.cursor = "wait";
        JsMwApi()({action:"query",prop:"info",titles:wgPageName+"/"+a+"|"+wgPageName,intoken:"edit"},function(res){
          res = res.query.pages;
          if( ! res ){
            $("#previewbox").empty().append($("<span>").css("color","#F00").text("Error: A discussion with this title already exists. Please choose a different title."));
            document.body.style.cursor = "";
            return;
          }
          JsMwApi()({action:"edit",title:wgPageName+"/"+a,createonly:"",text:"{{discussionsection|"+a+"}}\n"+b,watchlist:"watch",token:res.edittoken},function(){
            for(var i in res){
              i != -1 && JsMwApi()({action:"edit",title:wgPageName,summary:"/* " + a + " */ new section", appendtext:"\n\n{{/"+a+"}}",token:res.edittoken}, function(){
                location.href = location.pathname + "#" + a;
                location.reload();
              })
            }
          })
        })
      }),
      $("<button>").append("Preview").click(function(){
        $("#previewbox").empty().append("Loading...");
        JsMwApi()({action:"parse",prop:"text",title:wgPageName+"/"+$(this.parentNode).find("input").val(),text:$(this.parentNode).find("textarea").val()},function(res){
          console.log(res);
          $("#previewbox").html(res.parse.text);
        })
      })),
      $("<div>").attr("id","previewbox")
    ).unbind("click");
  })
})