#image-upload {
visibility: hidden;
}
+
+body.loading::before {
+ content: "";
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 10px;
+ background: #386ede;
+ z-index: 1100;
+ animation-name: load_animation;
+ animation-duration: 1000ms;
+ animation-timing-function: ease-out;
+ transition: opacity 200ms linear;
+}
+
+@keyframes load_animation {
+ 0% { right: 100%; }
+ 100% { right: 0%; }
+}
};
}(window, document));
-$(function() {
+function init_page() {
if (window.localStorage) {
var breadcrumbs = window.localStorage.wiki_breadcrumbs;
if (breadcrumbs) {
}
});
$('#quickedit input').trigger('change');
+
+ function load_page(href, push_history) {
+ $('body').addClass('loading');
+ var content = $.ajax({
+ url: href,
+ dataType: 'html',
+ success: function(html, status, xhr) {
+ Phylly.off(),
+ $('div[data-edit-url] > div').each(function(i, elem) {
+ Phylly.unbind_events(elem);
+ });
+ if (push_history) history.pushState({}, '', href);
+ $('body').removeClass('loading');
+ $('#main-content').replaceWith($(html).find('#main-content'));
+ init_page();
+ },
+ error: function() {
+ $('body').removeClass('loading');
+ },
+ });
+ }
+
+ $(window).on('popstate', function(e) {
+ load_page(location.href, false);
+ });
+
+ $('#main-content').on('click', 'a[href]:not([rel])', function(e) {
+ var href = this.attributes.href.nodeValue;
+ if (e.which === 2) return true;
+ if (href.slice(0, 6) == '/wiki/') {
+ load_page(this.href, true);
+ return false;
+ }
+ });
$('div.wiki-section').on('click', 'img[data-orig-url]', function() {
window.location = $(this).data('orig-url');
});
+}
+
+$(function() {
+ init_page();
});