From 2e30b421b403f70ee6b41fdfd8a0b8f1b9a140a8 Mon Sep 17 00:00:00 2001
From: Unknwon
Date: Sat, 15 Aug 2015 19:07:21 +0800
Subject: comletely remove v1 UI files of Gogs
---
public/js/app.js | 1188 --------------------------------------------
public/js/bootstrap.min.js | 6 -
public/js/lib.js | 495 ------------------
3 files changed, 1689 deletions(-)
delete mode 100644 public/js/app.js
delete mode 100755 public/js/bootstrap.min.js
delete mode 100644 public/js/lib.js
(limited to 'public/js')
diff --git a/public/js/app.js b/public/js/app.js
deleted file mode 100644
index 8eb19a0a..00000000
--- a/public/js/app.js
+++ /dev/null
@@ -1,1188 +0,0 @@
-var Gogits = {};
-
-(function ($) {
- // extend jQuery ajax, set csrf token value
- var ajax = $.ajax;
- $.extend({
- ajax: function (url, options) {
- if (typeof url === 'object') {
- options = url;
- url = undefined;
- }
- options = options || {};
- url = options.url;
- var csrftoken = $('meta[name=_csrf]').attr('content');
- var headers = options.headers || {};
- var domain = document.domain.replace(/\./ig, '\\.');
- if (!/^(http:|https:).*/.test(url) || eval('/^(http:|https:)\\/\\/(.+\\.)*' + domain + '.*/').test(url)) {
- headers = $.extend(headers, {'X-Csrf-Token': csrftoken});
- }
- options.headers = headers;
- var callback = options.success;
- options.success = function (data) {
- if (data.once) {
- // change all _once value if ajax data.once exist
- $('[name=_once]').val(data.once);
- }
- if (callback) {
- callback.apply(this, arguments);
- }
- };
- return ajax(url, options);
- },
-
- changeHash: function (hash) {
- if (history.pushState) {
- history.pushState(null, null, hash);
- }
- else {
- location.hash = hash;
- }
- },
-
- deSelect: function () {
- if (window.getSelection) {
- window.getSelection().removeAllRanges();
- } else {
- document.selection.empty();
- }
- }
- });
- $.fn.extend({
- toggleHide: function () {
- $(this).addClass("hidden");
- },
- toggleShow: function () {
- $(this).removeClass("hidden");
- },
- toggleAjax: function (successCallback, errorCallback) {
- var url = $(this).data("ajax");
- var method = $(this).data('ajax-method') || 'get';
- var ajaxName = $(this).data('ajax-name');
- var data = {};
-
- if (ajaxName.endsWith("preview")) {
- data["mode"] = "gfm";
- data["context"] = $(this).data('ajax-context');
- }
-
- $('[data-ajax-rel=' + ajaxName + ']').each(function () {
- var field = $(this).data("ajax-field");
- var t = $(this).data("ajax-val");
- if (t == "val") {
- data[field] = $(this).val();
- return true;
- }
- if (t == "txt") {
- data[field] = $(this).text();
- return true;
- }
- if (t == "html") {
- data[field] = $(this).html();
- return true;
- }
- if (t == "data") {
- data[field] = $(this).data("ajax-data");
- return true;
- }
- return true;
- });
- console.log("toggleAjax:", method, url, data);
- $.ajax({
- url: url,
- method: method.toUpperCase(),
- data: data,
- error: errorCallback,
- success: function (d) {
- if (successCallback) {
- successCallback(d);
- }
- }
- })
- }
- })
-}(jQuery));
-
-(function ($) {
-
- Gogits.showTab = function (selector, index) {
- if (!index) {
- index = 0;
- }
- $(selector).tab("show");
- $(selector).find("li:eq(" + index + ") a").tab("show");
- };
- Gogits.validateForm = function (selector, options) {
- var $form = $(selector);
- options = options || {};
- options.showErrors = function (map, list) {
- var $error = $form.find('.form-error').addClass('hidden');
- $('.has-error').removeClass("has-error");
- $error.text(list[0].message).show().removeClass("hidden");
- $(list[0].element).parents(".form-group").addClass("has-error");
- };
- $form.validate(options);
- };
-
- // ----- init elements
- Gogits.initModals = function () {
- var modals = $("[data-toggle=modal]");
- if (modals.length < 1) {
- return;
- }
- $.each(modals, function (i, item) {
- var hide = $(item).data('modal');
- $(item).modal(hide ? hide : "hide");
- });
- };
- Gogits.initTooltips = function () {
- $("body").tooltip({
- selector: "[data-toggle=tooltip]"
- //container: "body"
- });
- };
- Gogits.initPopovers = function () {
- var hideAllPopovers = function () {
- $('[data-toggle=popover]').each(function () {
- $(this).popover('hide');
- });
- };
-
- $(document).on('click', function (e) {
- var $e = $(e.target);
- if ($e.data('toggle') == 'popover' || $e.parents("[data-toggle=popover], .popover").length > 0) {
- return;
- }
- hideAllPopovers();
- });
-
- $("body").popover({
- selector: "[data-toggle=popover]"
- });
- };
- Gogits.initTabs = function () {
- var $tabs = $('[data-init=tabs]');
- $tabs.tab("show");
- $tabs.find("li:eq(0) a").tab("show");
- };
-
- // fix dropdown inside click
- Gogits.initDropDown = function () {
- $('.dropdown-menu.no-propagation').on('click', function (e) {
- e.stopPropagation();
- });
- };
-
-
- // render markdown
- Gogits.renderMarkdown = function () {
- var $md = $('.markdown');
- var $pre = $md.find('pre > code').parent();
- $pre.addClass('prettyprint linenums');
- prettyPrint();
-
- // Set anchor.
- var headers = {};
- $md.find('h1, h2, h3, h4, h5, h6').each(function () {
- var node = $(this);
- var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-'));
- var name = val;
- if (headers[val] > 0) {
- name = val + '-' + headers[val];
- }
- if (headers[val] == undefined) {
- headers[val] = 1;
- } else {
- headers[val] += 1;
- }
- node = node.wrap('
');
- node.append('');
- });
- };
-
- // render code view
- Gogits.renderCodeView = function () {
- function selectRange($list, $select, $from) {
- $list.removeClass('active');
- if ($from) {
- var a = parseInt($select.attr('rel').substr(1));
- var b = parseInt($from.attr('rel').substr(1));
- var c;
- if (a != b) {
- if (a > b) {
- c = a;
- a = b;
- b = c;
- }
- var classes = [];
- for (i = a; i <= b; i++) {
- classes.push('.L' + i);
- }
- $list.filter(classes.join(',')).addClass('active');
- $.changeHash('#L' + a + '-' + 'L' + b);
- return
- }
- }
- $select.addClass('active');
- $.changeHash('#' + $select.attr('rel'));
- }
-
- $(document).on('click', '.lines-num span', function (e) {
- var $select = $(this);
- var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li');
- selectRange($list, $list.filter('[rel=' + $select.attr('rel') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null));
- $.deSelect();
- });
-
- $('.code-view .lines-code > pre').each(function () {
- var $pre = $(this);
- var $lineCode = $pre.parent();
- var $lineNums = $lineCode.siblings('.lines-num');
- if ($lineNums.length > 0) {
- var nums = $pre.find('ol.linenums > li').length;
- for (var i = 1; i <= nums; i++) {
- $lineNums.append('' + i + '');
- }
- }
- });
-
- $(window).on('hashchange', function (e) {
- var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/);
- var $list = $('.code-view ol.linenums > li');
- if (m) {
- var $first = $list.filter('.' + m[1]);
- selectRange($list, $first, $list.filter('.' + m[2]));
- $("html, body").scrollTop($first.offset().top - 200);
- return;
- }
- m = window.location.hash.match(/^#(L\d+)$/);
- if (m) {
- var $first = $list.filter('.' + m[1]);
- selectRange($list, $first);
- $("html, body").scrollTop($first.offset().top - 200);
- }
- }).trigger('hashchange');
- };
-
- // copy utils
- Gogits.bindCopy = function (selector) {
- if ($(selector).hasClass('js-copy-bind')) {
- return;
- }
-
- if ( document.documentElement.classList.contains("is-copy-enabled") ) {
-
- $(selector).click(function(event) {
- var $this = $(this);
-
- var cfrom = $this.attr('data-copy-from');
- $(cfrom).select();
- document.execCommand('copy');
- getSelection().removeAllRanges();
-
- $this.tipsy("hide").attr('original-title', $this.data('after-title'));
- setTimeout(function () {
- $this.tipsy("show");
- }, 200);
- setTimeout(function () {
- $this.tipsy('hide').attr('original-title', $this.data('original-title'));
- }, 2000);
-
- this.blur();
- return;
- });
-
- $(selector).addClass("js-copy-bind");
-
- } else {
-
- $(selector).zclip({
- path: Gogits.AppSubUrl + "/js/ZeroClipboard.swf",
- copy: function () {
- var t = $(this).data("copy-val");
- var to = $($(this).data("copy-from"));
- var str = "";
- if (t == "txt") {
- str = to.text();
- }
- if (t == 'val') {
- str = to.val();
- }
- if (t == 'html') {
- str = to.html();
- }
- return str;
- },
- afterCopy: function () {
- var $this = $(this);
- $this.tipsy("hide").attr('original-title', $this.data('after-title'));
- setTimeout(function () {
- $this.tipsy("show");
- }, 200);
- setTimeout(function () {
- $this.tipsy('hide').attr('original-title', $this.data('original-title'));
- }, 2000);
- }
- }).addClass("js-copy-bind");
- }
- }
-
- // api working
- Gogits.getUsers = function (val, $target) {
- var notEmpty = function (str) {
- return str && str.length > 0;
- }
- $.ajax({
- url: '/api/v1/users/search?q=' + val,
- dataType: "json",
- success: function (json) {
- if (json.ok && json.data.length) {
- var html = '';
- $.each(json.data, function (i, item) {
- html += '
' + item.username;
- if (notEmpty(item.full_name)) {
- html += ' (' + item.full_name + ')';
- }
- html += '';
- });
- $target.toggleShow();
- $target.find('ul').html(html);
- } else {
- $target.toggleHide();
- }
- }
- });
- }
-
-})(jQuery);
-
-// ajax utils
-(function ($) {
- Gogits.ajaxDelete = function (url, data, success) {
- data = data || {};
- data._method = "DELETE";
- $.ajax({
- url: url,
- data: data,
- method: "POST",
- dataType: "json",
- success: function (json) {
- if (success) {
- success(json);
- }
- }
- })
- }
-})(jQuery);
-
-
-function initCore() {
- Gogits.initTooltips();
- Gogits.initPopovers();
- Gogits.initTabs();
- Gogits.initModals();
- Gogits.initDropDown();
- Gogits.renderMarkdown();
- Gogits.renderCodeView();
-}
-
-function initUserSetting() {
- // ssh confirmation
- $('#ssh-keys .delete').confirmation({
- singleton: true,
- onConfirm: function (e, $this) {
- Gogits.ajaxDelete("", {"id": $this.data("del")}, function (json) {
- if (json.ok) {
- window.location.reload();
- } else {
- alert(json.err);
- }
- });
- }
- });
-
- // profile form
- (function () {
- $('#user-setting-username').on("keyup", function () {
- var $this = $(this);
- if ($this.val() != $this.attr('title')) {
- $this.next('.help-block').toggleShow();
- } else {
- $this.next('.help-block').toggleHide();
- }
- });
- }())
-}
-
-function initRepository() {
- // clone group button script
- (function () {
- var $clone = $('.clone-group-btn');
- if ($clone.length) {
- var $url = $('.clone-group-url');
- $clone.find('button[data-link]').on("click", function (e) {
- var $this = $(this);
- if (!$this.hasClass('btn-primary')) {
- $clone.find('.input-group-btn .btn-primary').removeClass('btn-primary').addClass("btn-default");
- $(this).addClass('btn-primary').removeClass('btn-default');
- $url.val($this.data("link"));
- $clone.find('span.clone-url').text($this.data('link'));
- }
- }).eq(0).trigger("click");
- $("#repo-clone").on("shown.bs.dropdown", function () {
- Gogits.bindCopy("[data-init=copy]");
- });
- Gogits.bindCopy("[data-init=copy]:visible");
- }
- })();
-
- // watching script
- (function () {
- var $watch = $('#repo-watching'),
- watchLink = $watch.attr("data-watch"),
- // Use $.attr() to work around jQuery not finding $.data("unwatch") in Firefox,
- // which has a method "unwatch" on `Object` that gets returned instead.
- unwatchLink = $watch.attr("data-unwatch");
- $watch.on('click', '.to-watch', function () {
- if ($watch.hasClass("watching")) {
- return false;
- }
- $.get(watchLink, function (json) {
- if (json.ok) {
- $watch.find('.text-primary').removeClass('text-primary');
- $watch.find('.to-watch h4').addClass('text-primary');
- $watch.find('.fa-eye-slash').removeClass('fa-eye-slash').addClass('fa-eye');
- $watch.removeClass("no-watching").addClass("watching");
- }
- });
- return false;
- }).on('click', '.to-unwatch', function () {
- if ($watch.hasClass("no-watching")) {
- return false;
- }
- $.get(unwatchLink, function (json) {
- if (json.ok) {
- $watch.find('.text-primary').removeClass('text-primary');
- $watch.find('.to-unwatch h4').addClass('text-primary');
- $watch.find('.fa-eye').removeClass('fa-eye').addClass('fa-eye-slash');
- $watch.removeClass("watching").addClass("no-watching");
- }
- });
- return false;
- });
- })();
-
- // repo diff counter
- (function () {
- var $counter = $('.diff-counter');
- if ($counter.length < 1) {
- return;
- }
- $counter.each(function (i, item) {
- var $item = $(item);
- var addLine = $item.find('span[data-line].add').data("line");
- var delLine = $item.find('span[data-line].del').data("line");
- var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100;
- $item.find(".bar .add").css("width", addPercent + "%");
- });
- }());
-
- // repo setting form
- (function () {
- $('#repo-setting-name').on("keyup", function () {
- var $this = $(this);
- if ($this.val() != $this.attr('title')) {
- $this.next('.help-block').toggleShow();
- } else {
- $this.next('.help-block').toggleHide();
- }
- });
- }())
-}
-
-function initInstall() {
- // database type change
- (function () {
- var mysql_default = '127.0.0.1:3306';
- var postgres_default = '127.0.0.1:5432';
-
- $('#install-database').on("change", function () {
- var val = $(this).val();
- if (val != "SQLite3") {
- $('.server-sql').show();
- $('.sqlite-setting').addClass("hide");
- if (val == "PostgreSQL") {
- $('.pgsql-setting').removeClass("hide");
-
- // Change the host value to the Postgres default, but only
- // if the user hasn't already changed it from the MySQL
- // default.
- if ($('#database-host').val() == mysql_default) {
- $('#database-host').val(postgres_default);
- }
- } else if (val == 'MySQL') {
- $('.pgsql-setting').addClass("hide");
- if ($('#database-host').val() == postgres_default) {
- $('#database-host').val(mysql_default);
- }
- } else {
- $('.pgsql-setting').addClass("hide");
- }
- } else {
- $('.server-sql').hide();
- $('.sqlite-setting').removeClass("hide");
- }
- });
- }());
-
-}
-
-function initIssue() {
- // close button
- (function () {
- var $closeBtn = $('#issue-close-btn');
- var $openBtn = $('#issue-open-btn');
- $('#issue-reply-content').on("keyup", function () {
- if ($(this).val().length) {
- $closeBtn.val($closeBtn.data("text"));
- $openBtn.val($openBtn.data("text"));
- } else {
- $closeBtn.val($closeBtn.data("origin"));
- $openBtn.val($openBtn.data("origin"));
- }
- });
- }());
-
- // store unsend text in session storage.
- (function() {
- var $textArea = $("#issue-content,#issue-reply-content");
- var current = "";
-
- if ($textArea == null || !('sessionStorage' in window)) {
- return;
- }
-
- var path = location.pathname.split("/");
- var key = "issue-" + path[1] + "-" + path[2] + "-";
-
- if (/\/issues\/\d+$/.test(location.pathname)) {
- key = key + path[4];
- } else {
- key = key + "new";
- }
-
- if ($textArea.val() !== undefined && $textArea.val() !== "") {
- sessionStorage.setItem(key, $textArea.val());
- } else {
- $textArea.val(sessionStorage.getItem(key) || "");
-
- if ($textArea.attr("id") == "issue-reply-content") {
- var $closeBtn = $('#issue-close-btn');
- var $openBtn = $('#issue-open-btn');
-
- if ($textArea.val().length) {
- $closeBtn.val($closeBtn.data("text"));
- $openBtn.val($openBtn.data("text"));
- } else {
- $closeBtn.val($closeBtn.data("origin"));
- $openBtn.val($openBtn.data("origin"));
- }
- }
- }
-
- $textArea.on("keyup", function() {
- if ($textArea.val() !== current) {
- sessionStorage.setItem(key, current = $textArea.val());
- }
- });
- }());
-
- // Preview for images.
- (function() {
- var $hoverElement = $("");
- var $hoverImage = $("
");
-
- $hoverElement.addClass("attachment-preview");
- $hoverElement.hide();
-
- $hoverImage.addClass("attachment-preview-img");
-
- $hoverElement.append($hoverImage);
- $(document.body).append($hoverElement);
-
- var over = function() {
- var $this = $(this);
-
- if ((/\.(png|jpg|jpeg|gif)$/i).test($this.text()) == false) {
- return;
- }
-
- if ($hoverImage.attr("src") != $this.attr("href")) {
- $hoverImage.attr("src", $this.attr("href"));
- $hoverImage.load(function() {
- var height = this.height;
- var width = this.width;
-
- if (height > 300) {
- var factor = 300 / height;
-
- height = factor * height;
- width = factor * width;
- }
-
- $hoverImage.css({"height": height, "width": width});
-
- var offset = $this.offset();
- var left = offset.left, top = offset.top + $this.height() + 5;
-
- $hoverElement.css({"top": top + "px", "left": left + "px"});
- $hoverElement.css({"height": height + 16, "width": width + 16});
- $hoverElement.show();
- });
- } else {
- $hoverElement.show();
- }
- };
-
- var out = function() {
- $hoverElement.hide();
- };
-
- $(".issue-main .attachments .attachment").hover(over, out);
- }());
-
- // Upload.
- (function() {
- var $attachedList = $("#attached-list");
- var $addButton = $("#attachments-button");
- var files = [];
- var fileInput = document.getElementById("attachments-input");
-
- if (fileInput === null) {
- return;
- }
-
- $attachedList.on("click", "span.attachment-remove", function(event) {
- var $parent = $(this).parent();
-
- files.splice($parent.data("index"), 1);
- $parent.remove();
- });
-
- var clickedButton;
-
- $('input[type="submit"],input[type="button"],button.btn-success', fileInput.form).on('click', function() {
- clickedButton = this;
-
- var $button = $(this);
-
- $button.removeClass("btn-success btn-default");
- $button.addClass("btn-warning");
-
- $button.html("Submitting…");
- });
-
- fileInput.form.addEventListener("submit", function(event) {
- event.stopImmediatePropagation();
- event.preventDefault();
-
- //var data = new FormData(this);
-
- // Internet Explorer ... -_-
- var data = new FormData();
-
- $.each($("[name]", this), function(i, e) {
- if (e.name == "attachments" || e.type == "submit") {
- return;
- }
-
- data.append(e.name, $(e).val());
- });
-
- data.append(clickedButton.name, $(clickedButton).val());
-
- files.forEach(function(file) {
- data.append("attachments", file);
- });
-
- var xhr = new XMLHttpRequest();
-
- xhr.addEventListener("error", function() {
- console.log("Issue submit request failed. xhr.status: " + xhr.status);
- });
-
- xhr.addEventListener("load", function() {
- var response = xhr.response;
-
- if (typeof response == "string") {
- try {
- response = JSON.parse(response);
- } catch (err) {
- response = { ok: false, error: "Could not parse JSON" };
- }
- }
-
- if (response.ok === false) {
- $("#submit-error").text(response.error);
- $("#submit-error").show();
-
- var $button = $(clickedButton);
-
- $button.removeClass("btn-warning");
- $button.addClass("btn-danger");
-
- $button.text("An error occurred!");
-
- return;
- }
-
- if (!('sessionStorage' in window)) {
- return;
- }
-
- var path = location.pathname.split("/");
- var key = "issue-" + path[1] + "-" + path[2] + "-";
-
- if (/\/issues\/\d+$/.test(location.pathname)) {
- key = key + path[4];
- } else {
- key = key + "new";
- }
-
- sessionStorage.removeItem(key);
- window.location.href = response.data;
- });
-
- xhr.open("POST", this.action, true);
- xhr.send(data);
-
- return false;
- });
-
- fileInput.addEventListener("change", function() {
- for (var index = 0; index < fileInput.files.length; index++) {
- var file = fileInput.files[index];
-
- if (files.indexOf(file) > -1) {
- continue;
- }
-
- var $span = $("");
-
- $span.addClass("label");
- $span.addClass("label-default");
-
- $span.data("index", files.length);
-
- $span.append(file.name);
- $span.append(" ");
-
- $attachedList.append($span);
-
- files.push(file);
- }
-
- this.value = "";
- });
-
- $addButton.on("click", function(evt) {
- fileInput.click();
- evt.preventDefault();
- });
- }());
-
- // issue edit mode
- (function () {
- $("#issue-edit-btn").on("click", function () {
- $('#issue h1.title,#issue .issue-main > .issue-content .content,#issue-edit-btn').toggleHide();
- $('#issue-edit-title,.issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleShow();
- $('#issue-edit-content').focus();
- });
- $('.issue-edit-cancel').on("click", function () {
- $('#issue h1.title,#issue .issue-main > .issue-content .content,#issue-edit-btn').toggleShow();
- $('#issue-edit-title,.issue-edit-content,.issue-edit-cancel,.issue-edit-save').toggleHide();
- });
- }());
-
- // issue ajax update
- (function () {
- var $cnt = $('#issue-edit-content');
- $('.issue-edit-save').on("click", function () {
- $cnt.attr('data-ajax-rel', 'issue-edit-save');
- $(this).toggleAjax(function (json) {
- if (json.ok) {
- $('.issue-head h1.title').text(json.title);
- $('.issue-main > .issue-content .content').html(json.content);
- $('.issue-edit-cancel').trigger("click");
- }
- });
- setTimeout(function () {
- $cnt.attr('data-ajax-rel', 'issue-edit-preview');
- }, 200)
- });
- }());
-
- // issue ajax preview
- (function () {
- $('[data-ajax-name=issue-preview],[data-ajax-name=issue-edit-preview]').on("click", function () {
- var $this = $(this);
- $this.toggleAjax(function (resp) {
- $($this.data("preview")).html(resp);
- }, function () {
- $($this.data("preview")).html("no content");
- })
- });
- $('.issue-write a[data-toggle]').on("click", function () {
- var selector = $(this).parent().next(".issue-preview").find('a').data('preview');
- $(selector).html("loading...");
- });
- }());
-
- // assignee
- var is_issue_bar = $('.issue-bar').length > 0;
- var $a = $('.assignee');
- if ($a.data("assigned") > 0) {
- $('.clear-assignee').toggleShow();
- }
- $('.assignee', '#issue').on('click', 'li', function () {
- var uid = $(this).data("uid");
- if (is_issue_bar) {
- var assignee = $a.data("assigned");
- if (uid != assignee) {
- var text = $(this).text();
- var img = $("img", this).attr("src");
-
- $.post($a.data("ajax"), {
- issue: $('#issue').data("id"),
- assigneeid: uid
- }, function (json) {
- if (json.ok) {
- //window.location.reload();
- $a.data("assigned", uid);
-
- if (uid > 0) {
- $('.clear-assignee').toggleShow();
- $(".assignee > p").html('
' + text + '');
- } else {
- $('.clear-assignee').toggleHide();
- $(".assignee > p").text("No one assigned");
- }
- }
- })
- }
-
- return;
- }
- $('#assignee').val(uid);
- if (uid > 0) {
- $('.clear-assignee').toggleShow();
- $('#assigned').text($(this).find("strong").text())
- } else {
- $('.clear-assignee').toggleHide();
- $('#assigned').text($('#assigned').data("no-assigned"));
- }
- });
-
- // milestone
-
- $('#issue .dropdown-menu a[data-toggle="tab"]').on("click", function (e) {
- e.stopPropagation();
- $(this).tab('show');
- return false;
- });
-
- var $m = $('.milestone');
- if ($m.data("milestone") > 0) {
- $('.clear-milestone').toggleShow();
- }
- $('.milestone', '#issue').on('click', 'li.milestone-item', function () {
- var id = $(this).data("id");
- if (is_issue_bar) {
- var m = $m.data("milestone");
- if (id != m) {
- var text = $(this).text();
-
- $.post($m.data("ajax"), {
- issue: $('#issue').data("id"),
- milestoneid: id
- }, function (json) {
- if (json.ok) {
- //window.location.reload();
- $m.data("milestone", id);
-
- if (id > 0) {
- $('.clear-milestone').toggleShow();
- $(".milestone > .name").html('' + text + '');
- } else {
- $('.clear-milestone').toggleHide();
- $(".milestone > .name").text("No milestone");
- }
- }
- });
- }
-
- return;
- }
- $('#milestone-id').val(id);
- if (id > 0) {
- $('.clear-milestone').toggleShow();
- $('#milestone').text($(this).find("strong").text())
- } else {
- $('.clear-milestone').toggleHide();
- $('#milestone').text($('#milestone').data("no-milestone"));
- }
- });
-
- // labels
- var removeLabels = [];
- $('#label-manage-btn').on("click", function () {
- var $list = $('#label-list');
- if ($list.hasClass("managing")) {
- var ids = [];
- $list.find('li').each(function (i, item) {
- var id = $(item).data("id");
- if (id > 0) {
- ids.push(id);
- }
- });
- $.post($list.data("ajax"), {"ids": ids.join(","), "remove": removeLabels.join(",")}, function (json) {
- if (json.ok) {
- window.location.reload();
- }
- })
- } else {
- $list.addClass("managing");
- $list.find(".count").hide();
- $list.find(".del").show();
- $(this).text("Save Labels");
- $list.on('click', 'li.label-item', function () {
- var $this = $(this);
- $this.after($('.label-change-li').detach().show());
- $('#label-name-change-ipt').val($this.find('.name').text());
- var color = $this.find('.color').data("color");
- $('.label-change-color-picker').colorpicker("setValue", color);
- $('#label-color-change-ipt,#label-color-change-ipt2').val(color);
- $('#label-change-id-ipt').val($this.data("id"));
- return false;
- });
- }
- });
- var colorRegex = new RegExp("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$");
- $('#label-color-ipt2').on('keyup', function () {
- var val = $(this).val();
- if (val.length > 7) {
- $(this).val(val.substr(0, 7));
- }
- if (colorRegex.test(val)) {
- $('.label-color-picker').colorpicker("setValue", val);
- }
- return true;
- });
- $('#label-color-change-ipt2').on('keyup', function () {
- var val = $(this).val();
- console.log(val);
- if (val.length > 7) {
- $(this).val(val.substr(0, 7));
- }
- if (colorRegex.test(val)) {
- $('.label-change-color-picker').colorpicker("setValue", val);
- }
- return true;
- });
- $("#label-list").on('click', '.del', function () {
- var $p = $(this).parent();
- removeLabels.push($p.data('id'));
- $p.remove();
- return false;
- });
- $('.label-selected').each(function (i, item) {
- var $item = $(item);
- var color = $item.find('.color').data('color');
- $item.css('background-color', color);
- });
-
- $('.issue-bar .labels .dropdown-menu').on('click', 'li', function (e) {
- var $labels = $('.issue-bar .labels');
- var url = $labels.data("ajax");
- var id = $(this).data('id');
- var check = $(this).hasClass("checked");
- var item = this;
- $.post(url, {id: id, action: check ? 'detach' : "attach", issue: $('#issue').data('id')}, function (json) {
- if (json.ok) {
- if (check) {
- $("span.check.pull-left", item).remove();
-
- $(item).removeClass("checked");
- $(item).addClass("no-checked");
-
- $("#label-" + id, $labels).remove();
-
- if ($labels.children(".label-item").length == 0) {
- $labels.append("None yet
");
- }
- } else {
- $(item).prepend('');
-
- $(item).removeClass("no-checked");
- $(item).addClass("checked");
-
- $("p:not([class])", $labels).remove();
-
- var $l = $("");
- var c = $("span.color", item).css("background-color");
-
- $l.attr("id", "label-" + id);
- $l.attr("class", "label-item label-white");
- $l.css("background-color", c);
-
- $l.append("" + $(item).text() + "");
- $labels.append($l);
- }
- }
- });
- e.stopPropagation();
- return false;
- })
-}
-
-function initRelease() {
-// release new ajax preview
- (function () {
- $('[data-ajax-name=release-preview]').on("click", function () {
- var $this = $(this);
- $this.toggleAjax(function (resp) {
- $($this.data("preview")).html(resp);
- }, function () {
- $($this.data("preview")).html("no content");
- })
- });
- $('.release-write a[data-toggle]').on("click", function () {
- $('.release-preview-content').html("loading...");
- });
- }());
-
- // release new target selection
- (function () {
- $('#release-new-target-branch-list').on('click', 'a', function () {
- $('#tag-target').val($(this).text());
- $('#release-new-target-name').text(" " + $(this).text());
- });
- }());
-}
-
-function initRepoSetting() {
- // repo member add
- $('#repo-collaborator').on('keyup', function () {
- var $this = $(this);
- if (!$this.val()) {
- $this.next().toggleHide();
- return;
- }
- Gogits.getUsers($this.val(), $this.next());
- }).on('focus', function () {
- if (!$(this).val()) {
- $(this).next().toggleHide();
- }
- }).next().on("click", 'li', function () {
- $('#repo-collaborator').val($(this).text());
- });
-}
-
-function initRepoCreating() {
- // owner switch menu click
- (function () {
- $('#repo-owner-switch .dropdown-menu').on("click", "li", function () {
- var uid = $(this).data('uid');
- // set to input
- $('#repo-owner-id').val(uid);
- // set checked class
- if (!$(this).hasClass("checked")) {
- $(this).parent().find(".checked").removeClass("checked");
- $(this).addClass("checked");
- }
- // set button group to show clicked owner
- $('#repo-owner-avatar').attr("src", $(this).find('img').attr("src"));
- $('#repo-owner-name').text($(this).text().trim());
- console.log("set repo owner to uid :", uid, $(this).text().trim());
- });
- }());
- console.log("init repo-creating scripts");
-}
-
-function initOrganization() {
- (function(){
- $('#org-team-add-user').on('keyup', function () {
- var $this = $(this);
- if (!$this.val()) {
- $this.next().toggleHide();
- return;
- }
- Gogits.getUsers($this.val(), $this.next());
- }).on('focus', function () {
- if (!$(this).val()) {
- $(this).next().toggleHide();
- }
- }).next().on("click", 'li', function () {
- $('#org-team-add-user').val($(this).text());
- $('#org-team-add-user-form').submit();
- }).toggleHide();
- console.log("init script : add user to team");
- }());
-
- (function(){
- $('#org-team-add-repo').next().toggleHide();
- console.log("init script : add repository to team");
- }());
-
-
- console.log("init script : organization done");
-}
-
-function initTimeSwitch() {
- $(".time-since[title]").on("click", function() {
- var $this = $(this);
-
- var title = $this.attr("title");
- var text = $this.text();
-
- $this.text(title);
- $this.attr("title", text);
- });
-}
-
-(function ($) {
- $(function () {
- initCore();
- var body = $("#body");
- if (body.data("page") == "user") {
- initUserSetting();
- }
- if ($('.repo-nav').length) {
- initRepository();
- }
- if ($('#install-card').length) {
- initInstall();
- }
- if ($('#issue').length) {
- initIssue();
- }
- if ($('#release').length) {
- initRelease();
- }
- if ($('#repo-setting-container').length) {
- initRepoSetting();
- }
- if ($('#repo-create').length) {
- initRepoCreating();
- }
- if ($('#body-nav').hasClass("org-nav")) {
- initOrganization();
- }
-
- initTimeSwitch();
- });
-})(jQuery);
-
-String.prototype.endsWith = function (suffix) {
- return this.indexOf(suffix, this.length - suffix.length) !== -1;
-};
diff --git a/public/js/bootstrap.min.js b/public/js/bootstrap.min.js
deleted file mode 100755
index d6821920..00000000
--- a/public/js/bootstrap.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
- * Bootstrap v3.1.0 (http://getbootstrap.com)
- * Copyright 2011-2014 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- */
-if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
diff --git a/public/js/lib.js b/public/js/lib.js
deleted file mode 100644
index bd42152b..00000000
--- a/public/js/lib.js
+++ /dev/null
@@ -1,495 +0,0 @@
-/* ===========================================================
- * forked from bootstrap-confirmation.js
- * http://ethaizone.github.io/Bootstrap-Confirmation/
- * ===========================================================
- * Copyright 2013 Nimit Suwannagate
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================== */
-!function ($) {
- 'use strict';
-
- //var for check event at body can have only one.
- var event_body = false;
-
- // CONFIRMATION PUBLIC CLASS DEFINITION
- // ===============================
- var Confirmation = function (element, options) {
- var that = this;
-
- this.init('confirmation', element, options);
-
-
- $(element).on('show.bs.confirmation', function(e) {
- that.options.onShow(e, this);
-
- $(this).addClass('open');
-
- var options = that.options;
- var all = options.all_selector;
-
- if(options.singleton) {
- $(all+'.in').not(that.$element).confirmation('hide');
- }
- });
-
- $(element).on('hide.bs.confirmation', function(e) {
- that.options.onHide(e, this);
-
- $(this).removeClass('open');
- });
-
- $(element).on('shown.bs.confirmation', function(e) {
- var options = that.options;
- var all = options.all_selector;
-
- that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that));
-
- if(that.isPopout()) {
- if(!event_body) {
- event_body = $('body').on('click', function (e) {
- if(that.$element.is(e.target)) return;
- if(that.$element.has(e.target).length) return;
- if($('.popover').has(e.target).length) return;
-
- that.$element.confirmation('hide');
-
- $('body').unbind(e);
-
- event_body = false;
-
- return;
- });
- }
- }
- });
-
- $(element).on('click', function(e) {
- e.preventDefault();
- });
- }
-
- if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');
-
- Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
- placement : 'top',
- title : 'Are you sure?',
- btnOkClass : 'btn btn-danger btn-sm',
- btnOkLabel : 'Yes',
- btnOkIcon : '',
- btnCancelClass : 'btn btn-default btn-sm',
- btnCancelLabel : 'Cancel',
- btnCancelIcon : '',
- href : '#',
- target : '_self',
- singleton : true,
- popout : true,
- onShow : function(event, element){},
- onHide : function(event, element){},
- onConfirm : function(event, element){},
- onCancel : function(event, element){},
- template : ''
- });
-
-
- // NOTE: CONFIRMATION EXTENDS popover.js
- // ================================
- Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype);
-
- Confirmation.prototype.constructor = Confirmation;
-
- Confirmation.prototype.getDefaults = function () {
- return Confirmation.DEFAULTS;
- }
-
- Confirmation.prototype.setContent = function () {
- var that = this;
- var $tip = this.tip();
- var title = this.getTitle();
- var $btnOk = $tip.find('[data-apply="confirmation"]');
- var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
- var options = this.options
-
- $btnOk.addClass(this.getBtnOkClass())
- .html(this.getBtnOkLabel())
- .prepend($('').addClass(this.getBtnOkIcon()), " ")
- .attr('href', this.getHref())
- .attr('target', this.getTarget())
- .off('click').on('click', function(event) {
- options.onConfirm(event, that.$element);
-
- that.$element.confirmation('hide');
- });
-
- $btnCancel.addClass(this.getBtnCancelClass())
- .html(this.getBtnCancelLabel())
- .prepend($('').addClass(this.getBtnCancelIcon()), " ")
- .off('click').on('click', function(event){
- options.onCancel(event, that.$element);
-
- that.$element.confirmation('hide');
- });
-
- $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
-
- $tip.removeClass('fade top bottom left right in');
-
- // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
- // this manually by checking the contents.
- if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
- }
-
- Confirmation.prototype.getBtnOkClass = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call($e[0]) : o.btnOkClass);
- }
-
- Confirmation.prototype.getBtnOkLabel = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call($e[0]) : o.btnOkLabel);
- }
-
- Confirmation.prototype.getBtnOkIcon = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call($e[0]) : o.btnOkIcon);
- }
-
- Confirmation.prototype.getBtnCancelClass = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call($e[0]) : o.btnCancelClass);
- }
-
- Confirmation.prototype.getBtnCancelLabel = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call($e[0]) : o.btnCancelLabel);
- }
-
- Confirmation.prototype.getBtnCancelIcon = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call($e[0]) : o.btnCancelIcon);
- }
-
- Confirmation.prototype.getHref = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call($e[0]) : o.href);
- }
-
- Confirmation.prototype.getTarget = function () {
- var $e = this.$element;
- var o = this.options;
-
- return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call($e[0]) : o.target);
- }
-
- Confirmation.prototype.isPopout = function () {
- var popout;
- var $e = this.$element;
- var o = this.options;
-
- popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call($e[0]) : o.popout);
-
- if(popout == 'false') popout = false;
-
- return popout
- }
-
-
- // CONFIRMATION PLUGIN DEFINITION
- // =========================
- var old = $.fn.confirmation;
-
- $.fn.confirmation = function (option) {
- var that = this;
-
- return this.each(function () {
- var $this = $(this);
- var data = $this.data('bs.confirmation');
- var options = typeof option == 'object' && option;
-
- options = options || {};
- options.all_selector = that.selector;
-
- if (!data && option == 'destroy') return;
- if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options)));
- if (typeof option == 'string') data[option]();
- });
- }
-
- $.fn.confirmation.Constructor = Confirmation
-
-
- // CONFIRMATION NO CONFLICT
- // ===================
- $.fn.confirmation.noConflict = function () {
- $.fn.confirmation = old;
-
- return this;
- }
-}(jQuery);
-
-/*!
- * jQuery Cookie Plugin v1.4.0
- * https://github.com/carhartl/jquery-cookie
- *
- * Copyright 2013 Klaus Hartl
- * Released under the MIT license
- */
-(function(c){"function"===typeof define&&define.amd?define(["jquery"],c):c(jQuery)})(function(c){function m(b){return f.raw?b:encodeURIComponent(b)}function n(b,e){var a;if(f.raw)a=b;else a:{var d=b;0===d.indexOf('"')&&(d=d.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{d=decodeURIComponent(d.replace(l," "));a=f.json?JSON.parse(d):d;break a}catch(g){}a=void 0}return c.isFunction(e)?e(a):a}var l=/\+/g,f=c.cookie=function(b,e,a){if(void 0!==e&&!c.isFunction(e)){a=c.extend({},f.defaults,
-a);if("number"===typeof a.expires){var d=a.expires,g=a.expires=new Date;g.setDate(g.getDate()+d)}return document.cookie=[m(b),"=",m(f.json?JSON.stringify(e):String(e)),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}a=b?void 0:{};for(var d=document.cookie?document.cookie.split("; "):[],g=0,l=d.length;gc;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(this))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push(""),c.push(d(a.substring(e,e+f))),c.push(""),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw new Error(c+" must be a function or a falsy value")}function K(b){return a.isFunction(b)?b():b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(q(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=N(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,h,i,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=w(function(){return c.element.closest("body")}),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),u(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),t(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||p(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=b},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:q(a.attr("locked"),"locked")||q(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a