Fandom

Virtual Skipper Wiki

Form:Favorites/code.js

192pages on
this wiki
Add New Page
Talk0
/*
*/
 function synchronizeFavoredby() {
 /*
  For a description of when and why you might want to use a function like this read:
  http: //www.mediawiki.org/wiki/Extension_talk:Semantic_Forms#Possible_applications
 */
    var str = $("#Favoredby").text();   /* accesses the contemporary semantic data */
    $("#bodyContent form.createbox fieldset")
     .find("input.createboxInput[type='text'][name$='[Favoredby]']")
     .val(str.replace(/^\s+|\s+$/g, ''));  /* populates the form's (input type = text) field  - trimming whitespace */
 }
 $( synchronizeFavoredby );
 
 function Favorites() {
 /*
  Required for the "Manage your Favorites" feature. See also companions Template:Favorites and Form:Favorites
 */
    $("#bodyContent form.createbox fieldset ")
    .find("input.createboxInput[type='text'][name$='[Thisuser]']")
    .val(wgUserName)                    /* Auto-populate the text input field with current user name  */
    .attr("readonly","readonly")        /* Write-protect text input field */
    .attr("size","0");                  /* Shrink box to fit data */
    /*
      Now set the Remove||Add radiobuttons based on the presence||absence of the wgUserName within the fanList
    */
    var fans = $("#Favoredby").text();  /* Accesses the up-to-date semantic data */
    var reg = new RegExp("[ ,]+", "g"); /* Both comma and space are delimiters */
    var fanArr = fans.split(reg);
    if ( $.inArray(wgUserName,fanArr) < 0 )
      {
        $("#bodyContent input:radio[checked][value!='Add'][name$='[Operation]']")
            .removeAttr("checked");     /* Uncheck any checked radio element that does not match the target value */
        $("#bodyContent input:radio:not([checked])[value='Add'][name$='[Operation]']")
            .attr("checked","checked"); /* Check any unchecked radio element that does match the target value */
      }
    else
      {
        $("#bodyContent input:radio[checked][value!='Remove'][name$='[Operation]']")
            .removeAttr("checked");     /* Uncheck any checked radio element that does not match the target value */
        $("#bodyContent input:radio:not([checked])[value='Remove'][name$='[Operation]']")
            .attr("checked","checked"); /* Check any unchecked radio element that does match the target value */
      }
    /*
      Finally check the Minor edit checkbox - we don't want [[Special:Recent changes]] to be cluttered with edits due to favorites.
    */
    $("#wpMinoredit").attr("checked","checked");
 }
 $( Favorites );
/*
*/

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki