mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
Upgraded external js files: bootstrap-tour, jquery-ui.min,
jquery.cookie, jquery.min
This commit is contained in:
parent
c4b34a2d93
commit
d823a762b0
5 changed files with 218 additions and 485 deletions
72
public/js/bootstrap-tour.js
vendored
72
public/js/bootstrap-tour.js
vendored
|
|
@ -9,9 +9,9 @@
|
|||
# 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.
|
||||
|
|
@ -30,8 +30,11 @@
|
|||
function Tour(options) {
|
||||
var _this = this;
|
||||
this._options = $.extend({
|
||||
name: 'tour',
|
||||
afterSetState: function(key, value) {},
|
||||
afterGetState: function(key, value) {}
|
||||
afterGetState: function(key, value) {},
|
||||
onShow: function(tour) {},
|
||||
onHide: function(tour) {}
|
||||
}, options);
|
||||
this._steps = [];
|
||||
this.setCurrentStep();
|
||||
|
|
@ -39,6 +42,10 @@
|
|||
e.preventDefault();
|
||||
return _this.next();
|
||||
});
|
||||
$(document).on("click", ".popover .prev", function(e) {
|
||||
e.preventDefault();
|
||||
return _this.prev();
|
||||
});
|
||||
$(document).on("click", ".popover .end", function(e) {
|
||||
e.preventDefault();
|
||||
return _this.end();
|
||||
|
|
@ -46,7 +53,7 @@
|
|||
}
|
||||
|
||||
Tour.prototype.setState = function(key, value) {
|
||||
$.cookie("tour_" + key, value, {
|
||||
$.cookie("" + this._options.name + "_" + key, value, {
|
||||
expires: 36500,
|
||||
path: '/'
|
||||
});
|
||||
|
|
@ -55,7 +62,7 @@
|
|||
|
||||
Tour.prototype.getState = function(key) {
|
||||
var value;
|
||||
value = $.cookie("tour_" + key);
|
||||
value = $.cookie("" + this._options.name + "_" + key);
|
||||
this._options.afterGetState(key, value);
|
||||
return value;
|
||||
};
|
||||
|
|
@ -70,9 +77,11 @@
|
|||
placement: "right",
|
||||
title: "",
|
||||
content: "",
|
||||
next: i + 1,
|
||||
end: i === this._steps.length - 1,
|
||||
animation: true
|
||||
next: i === this._steps.length - 1 ? -1 : i + 1,
|
||||
prev: i - 1,
|
||||
animation: true,
|
||||
onShow: this._options.onShow,
|
||||
onHide: this._options.onHide
|
||||
}, this._steps[i]);
|
||||
};
|
||||
|
||||
|
|
@ -90,6 +99,11 @@
|
|||
return this.showNextStep();
|
||||
};
|
||||
|
||||
Tour.prototype.prev = function() {
|
||||
this.hideStep(this._current);
|
||||
return this.showPrevStep();
|
||||
};
|
||||
|
||||
Tour.prototype.end = function() {
|
||||
this.hideStep(this._current);
|
||||
return this.setState("end", "yes");
|
||||
|
|
@ -116,26 +130,17 @@
|
|||
};
|
||||
|
||||
Tour.prototype.showStep = function(i) {
|
||||
var endOnClick, step,
|
||||
_this = this;
|
||||
step = this.getStep(i);
|
||||
if (step.element == null) {
|
||||
this.end;
|
||||
return;
|
||||
}
|
||||
var step;
|
||||
this.setCurrentStep(i);
|
||||
step = this.getStep(i);
|
||||
if (step.path !== "" && document.location.pathname !== step.path && document.location.pathname.replace(/^.*[\\\/]/, '') !== step.path) {
|
||||
document.location.href = step.path;
|
||||
return;
|
||||
}
|
||||
if ($(step.element).is(":hidden")) {
|
||||
if (!((step.element != null) && $(step.element).length !== 0 && $(step.element).is(":visible"))) {
|
||||
this.showNextStep();
|
||||
return;
|
||||
}
|
||||
endOnClick = step.endOnClick || step.element;
|
||||
$(endOnClick).one("click", function() {
|
||||
return _this.endCurrentStep();
|
||||
});
|
||||
if (step.onShow != null) {
|
||||
step.onShow(this);
|
||||
}
|
||||
|
|
@ -156,27 +161,30 @@
|
|||
}
|
||||
};
|
||||
|
||||
Tour.prototype.endCurrentStep = function() {
|
||||
var step;
|
||||
this.hideStep(this._current);
|
||||
step = this.getStep(this._current);
|
||||
return this.setCurrentStep(step.next);
|
||||
};
|
||||
|
||||
Tour.prototype.showNextStep = function() {
|
||||
var step;
|
||||
step = this.getStep(this._current);
|
||||
return this.showStep(step.next);
|
||||
};
|
||||
|
||||
Tour.prototype.showPrevStep = function() {
|
||||
var step;
|
||||
step = this.getStep(this._current);
|
||||
return this.showStep(step.prev);
|
||||
};
|
||||
|
||||
Tour.prototype._showPopover = function(step, i) {
|
||||
var content, tip;
|
||||
var content, nav, tip;
|
||||
content = "" + step.content + "<br /><p>";
|
||||
if (step.end) {
|
||||
content += "<a href='#' class='end'>End</a>";
|
||||
} else {
|
||||
content += "<a href='#" + step.next + "' class='next'>Next »</a> <a href='#' class='pull-right end'>End tour</a></p>";
|
||||
nav = [];
|
||||
if (step.prev >= 0) {
|
||||
nav.push("<a href='#" + step.prev + "' class='prev'>« Prev</a>");
|
||||
}
|
||||
if (step.next >= 0) {
|
||||
nav.push("<a href='#" + step.next + "' class='next'>Next »</a>");
|
||||
}
|
||||
content += nav.join(" | ");
|
||||
content += "<a href='#' class='pull-right end'>End Tour</a>";
|
||||
$(step.element).popover({
|
||||
placement: step.placement,
|
||||
trigger: "manual",
|
||||
|
|
|
|||
539
public/js/jquery-ui.min.js
vendored
Normal file → Executable file
539
public/js/jquery-ui.min.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,6 @@
|
|||
/*jshint eqnull:true */
|
||||
/*!
|
||||
* jQuery Cookie Plugin
|
||||
* jQuery Cookie Plugin v1.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2011, Klaus Hartl
|
||||
|
|
@ -7,41 +8,54 @@
|
|||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.opensource.org/licenses/GPL-2.0
|
||||
*/
|
||||
(function($) {
|
||||
$.cookie = function(key, value, options) {
|
||||
(function($, document) {
|
||||
|
||||
// key and at least value given, set cookie...
|
||||
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
|
||||
options = $.extend({}, options);
|
||||
var pluses = /\+/g;
|
||||
function raw(s) {
|
||||
return s;
|
||||
}
|
||||
function decoded(s) {
|
||||
return decodeURIComponent(s.replace(pluses, ' '));
|
||||
}
|
||||
|
||||
if (value === null || value === undefined) {
|
||||
options.expires = -1;
|
||||
}
|
||||
$.cookie = function(key, value, options) {
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setDate(t.getDate() + days);
|
||||
}
|
||||
// key and at least value given, set cookie...
|
||||
if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value == null)) {
|
||||
options = $.extend({}, $.cookie.defaults, options);
|
||||
|
||||
value = String(value);
|
||||
if (value == null) {
|
||||
options.expires = -1;
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setDate(t.getDate() + days);
|
||||
}
|
||||
|
||||
// key and possibly options given, get cookie...
|
||||
options = value || {};
|
||||
var decode = options.raw ? function(s) { return s; } : decodeURIComponent;
|
||||
value = String(value);
|
||||
|
||||
var pairs = document.cookie.split('; ');
|
||||
for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
|
||||
if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
|
||||
}
|
||||
return null;
|
||||
};
|
||||
})(jQuery);
|
||||
return (document.cookie = [
|
||||
encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// key and possibly options given, get cookie...
|
||||
options = value || $.cookie.defaults || {};
|
||||
var decode = options.raw ? raw : decoded;
|
||||
var cookies = document.cookie.split('; ');
|
||||
for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) {
|
||||
if (decode(parts.shift()) === key) {
|
||||
return decode(parts.join('='));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
$.cookie.defaults = {};
|
||||
|
||||
})(jQuery, document);
|
||||
|
|
|
|||
8
public/js/jquery.min.js
vendored
8
public/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -260,9 +260,9 @@
|
|||
<Scripts:>
|
||||
<script src=/js/jquery.min.js></script><!-- http://code.jquery.com/jquery-1.7.2.min.js -->
|
||||
<script src=/js/jquery-ui.min.js></script>
|
||||
<script src=/js/bootstrap.min.js></script>
|
||||
<script src=/js/jquery.cookie.js></script>
|
||||
<script src=/js/bootstrap-tour.js></script>
|
||||
<script src=/js/bootstrap.min.js></script><!-- http://twitter.github.com/bootstrap/assets/js/bootstrap.min.js -->
|
||||
<script src=/js/jquery.cookie.js></script><!-- https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js -->
|
||||
<script src=/js/bootstrap-tour.js></script><!-- https://raw.github.com/pushly/bootstrap-tour/master/bootstrap-tour.js -->
|
||||
<script src=/js/google-jsapi.js></script><!-- https://www.google.com/jsapi -->
|
||||
<script>
|
||||
google.load("visualization", "1", {packages:["corechart"]});
|
||||
|
|
|
|||
Loading…
Reference in a new issue