User:MateyY/Module.js

/* A module constructor plugin * Relies on jQuery * Version 1.0 * By MateyY * Please import */ (function($) {    $.fn.railModule = function(settings) {         var $rail = $("#WikiaRail"),              $module = $rail.find(".module:eq(" + settings.position + ")"),              $new = $(this).addClass("module");          if (!settings) settings = {}; //Evade errors          if (!settings.position) settings.position = 0;          else if (settings.position < 0) settings.position = $module.length + settings.position; //Negative values          $rail.find(".module").length < settings.position ? $new.insertAfter($rail.find(".module:last")) : $new.insertBefore($module);          if (settings.content) {               typeof settings.content === "string" ? $new.html(settings.content) : $new.append(settings.content);          }          if (settings.css) $new.css(settings.css);          return this;     }; })(jQuery);