added more rt.gnu.org weblabels
authorAndrew Engelbrecht <andrew@fsf.org>
Wed, 17 May 2017 19:58:56 +0000 (15:58 -0400)
committerAndrew Engelbrecht <andrew@fsf.org>
Wed, 17 May 2017 19:58:56 +0000 (15:58 -0400)
rt.gnu.org/CURRENT/files/etc/jquery.modal.js [new file with mode: 0644]
rt.gnu.org/CURRENT/index.html

diff --git a/rt.gnu.org/CURRENT/files/etc/jquery.modal.js b/rt.gnu.org/CURRENT/files/etc/jquery.modal.js
new file mode 100644 (file)
index 0000000..5ceffdc
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+    A simple jQuery modal (http://github.com/kylefox/jquery-modal)
+    Version 0.5.2
+*/
+(function($) {
+
+  var current = null;
+
+  $.modal = function(el, options) {
+    $.modal.close(); // Close any open modals.
+    var remove, target;
+    this.$body = $('body');
+    this.options = $.extend({}, $.modal.defaults, options);
+    if (el.is('a')) {
+      target = el.attr('href');
+      //Select element by id from href
+      if (/^#/.test(target)) {
+        this.$elm = $(target);
+        if (this.$elm.length !== 1) return null;
+        this.open();
+      //AJAX
+      } else {
+        this.$elm = $('<div>');
+        this.$body.append(this.$elm);
+        remove = function(event, modal) { modal.elm.remove(); };
+        this.showSpinner();
+        el.trigger($.modal.AJAX_SEND);
+        $.get(target).done(function(html) {
+          if (!current) return;
+          el.trigger($.modal.AJAX_SUCCESS);
+          current.$elm.empty().append(html).on($.modal.CLOSE, remove);
+          current.hideSpinner();
+          current.open();
+          el.trigger($.modal.AJAX_COMPLETE);
+        }).fail(function() {
+          el.trigger($.modal.AJAX_FAIL);
+          current.hideSpinner();
+          el.trigger($.modal.AJAX_COMPLETE);
+        });
+      }
+    } else {
+      this.$elm = el;
+      this.open();
+    }
+  };
+
+  $.modal.prototype = {
+    constructor: $.modal,
+
+    open: function() {
+      this.block();
+      this.show();
+      if (this.options.escapeClose) {
+        $(document).on('keydown.modal', function(event) {
+          if (event.which == 27) $.modal.close();
+        });
+      }
+      if (this.options.clickClose) this.blocker.click($.modal.close);
+    },
+
+    close: function() {
+      this.unblock();
+      this.hide();
+      $(document).off('keydown.modal');
+    },
+
+    block: function() {
+      this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
+      this.blocker = $('<div class="jquery-modal blocker"></div>').css({
+        top: 0, right: 0, bottom: 0, left: 0,
+        width: "100%", height: "100%",
+        position: "fixed",
+        zIndex: this.options.zIndex,
+        background: this.options.overlay,
+        opacity: this.options.opacity
+      });
+      this.$body.append(this.blocker);
+      this.$elm.trigger($.modal.BLOCK, [this._ctx()]);
+    },
+
+    unblock: function() {
+      this.blocker.remove();
+    },
+
+    show: function() {
+      this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]);
+      if (this.options.showClose) {
+        this.closeButton = $('<a href="#close-modal" rel="modal:close" class="close-modal">' + this.options.closeText + '</a>');
+        this.$elm.append(this.closeButton);
+      }
+      this.$elm.addClass(this.options.modalClass + ' current');
+      this.center();
+      this.$elm.show().trigger($.modal.OPEN, [this._ctx()]);
+    },
+
+    hide: function() {
+      this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]);
+      if (this.closeButton) this.closeButton.remove();
+      this.$elm.removeClass('current').hide();
+      this.$elm.trigger($.modal.CLOSE, [this._ctx()]);
+    },
+
+    showSpinner: function() {
+      if (!this.options.showSpinner) return;
+      this.spinner = this.spinner || $('<div class="' + this.options.modalClass + '-spinner"></div>')
+        .append(this.options.spinnerHtml);
+      this.$body.append(this.spinner);
+      this.spinner.show();
+    },
+
+    hideSpinner: function() {
+      if (this.spinner) this.spinner.remove();
+    },
+
+    center: function() {
+      this.$elm.css({
+        position: 'fixed',
+        top: "50%",
+        left: "50%",
+        marginTop: - (this.$elm.outerHeight() / 2),
+        marginLeft: - (this.$elm.outerWidth() / 2),
+        zIndex: this.options.zIndex + 1
+      });
+    },
+
+    //Return context for custom events
+    _ctx: function() {
+      return { elm: this.$elm, blocker: this.blocker, options: this.options };
+    }
+  };
+
+  //resize is alias for center for now
+  $.modal.prototype.resize = $.modal.prototype.center;
+
+  $.modal.close = function(event) {
+    if (!current) return;
+    if (event) event.preventDefault();
+    current.close();
+    current = null;
+  };
+
+  $.modal.resize = function() {
+    if (!current) return;
+    current.resize();
+  };
+
+  $.modal.defaults = {
+    overlay: "#000",
+    opacity: 0.75,
+    zIndex: 1,
+    escapeClose: true,
+    clickClose: true,
+    closeText: 'Close',
+    modalClass: "modal",
+    spinnerHtml: null,
+    showSpinner: true,
+    showClose: true
+  };
+
+  // Event constants
+  $.modal.BEFORE_BLOCK = 'modal:before-block';
+  $.modal.BLOCK = 'modal:block';
+  $.modal.BEFORE_OPEN = 'modal:before-open';
+  $.modal.OPEN = 'modal:open';
+  $.modal.BEFORE_CLOSE = 'modal:before-close';
+  $.modal.CLOSE = 'modal:close';
+  $.modal.AJAX_SEND = 'modal:ajax:send';
+  $.modal.AJAX_SUCCESS = 'modal:ajax:success';
+  $.modal.AJAX_FAIL = 'modal:ajax:fail';
+  $.modal.AJAX_COMPLETE = 'modal:ajax:complete';
+
+  $.fn.modal = function(options){
+    if (this.length === 1) {
+      current = new $.modal(this, options);
+    }
+    return this;
+  };
+
+  // Automatically bind links with rel="modal:close" to, well, close the modal.
+  $(document).on('click', 'a[rel="modal:close"]', $.modal.close);
+  $(document).on('click', 'a[rel="modal:open"]', function(event) {
+    event.preventDefault();
+    $(this).modal();
+  });
+})(jQuery);
index 77f1022fd01b54e2a431c04d1793c1bc4c04ee2c..a070d79972018bf1f1b59b34f67253942ffd86cb 100644 (file)
   <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/titlebox-state.js">titlebox-state.js</a></td>
 </tr>
 
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/jquery_noconflict.js">jquery_noconflict.js</a></td>
+  <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/jquery_noconflict.js">jquery_noconflict.js</a></td>
+</tr>
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/jquery-ui-patch-datepicker.js">jquery-ui-patch-datepicker.js</a></td>
+  <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/jquery-ui-patch-datepicker.js">jquery-ui-patch-datepicker.js</a></td>
+</tr>
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/jquery.modal-defaults.js">jquery.modal-defaults.js</a></td>
+  <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/jquery.modal-defaults.js">jquery.modal-defaults.js</a></td>
+</tr>
+
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/superfish.js">superfish.js</a></td>
+  <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/superfish.js">superfish.js</a></td>
+</tr>
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/supersubs.js">supersubs.js</a></td>
+  <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/supersubs.js">supersubs.js</a></td>
+</tr>
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/jquery.cookie.js">jquery.cookie.js</a></td>
+  <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/share/static/js/jquery.cookie.js">jquery.cookie.js</a></td>
+</tr>
+
+<tr>
+  <td><a href="https://rt.gnu.org/static/js/jquery.modal.min.js">jquery.modal.min.js</a></td>
+  <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
+  <td><a href="/rt.gnu.org/CURRENT/files/etc/jquery.modal.js">jquery.modal.js</a></td>
+</tr>
+
+
+
 
 
 </table>