auto formatted js files

pull/1237/head
Josh Barr 2015-04-25 17:52:54 +12:00
rodzic d5045a620a
commit 3319d87195
23 zmienionych plików z 394 dodań i 371 usunięć

1
.gitignore vendored
Wyświetl plik

@ -9,3 +9,4 @@
/.tox/
/venv
/node_modules/
npm-debug.log

Wyświetl plik

@ -46,7 +46,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
self.container.slideDown();
// focus first suitable input found
var timeout = setTimeout(function(){
var timeout = setTimeout(function() {
$('.input input,.input textarea,.input .richtext', self.container).first().focus();
}, 250);
};
@ -76,8 +76,10 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
countField.val(newIndex + 1);
return opts.prefix + '-' + newIndex;
}
function setInitialMoveUpDownState(newMember) {
}
function postInsertMember(newMember) {
/* run any supplied initializer functions */
if (opts.onInitializeMember) {
@ -121,6 +123,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
for (var i = index; i < members.length; i++) {
members[i].setIndex(i + 1);
}
members.splice(index, 0, newMember);
newMember.setIndex(index);
@ -147,6 +150,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
for (var i = index; i < members.length; i++) {
members[i].setIndex(i + 1);
}
members.splice(index, 0, newMember);
newMember.setIndex(index);
@ -176,6 +180,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
for (var i = 0; i < members.length; i++) {
members[i].setIndex(i + 1);
}
members.unshift(newMember);
newMember.setIndex(0);
@ -224,6 +229,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
/* deleting the first member; the new first member cannot move up now */
opts.onDisableMoveUp(members[0]);
}
if (index === members.length && members.length > 0 && opts.onDisableMoveDown) {
/* deleting the last member; the new last member cannot move down now */
opts.onDisableMoveDown(members[members.length - 1]);
@ -252,6 +258,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
if (opts.onDisableMoveUp) opts.onDisableMoveUp(member);
if (opts.onEnableMoveUp) opts.onEnableMoveUp(swappedMember);
}
if (oldIndex === (members.length - 1)) {
/*
member was previously the last member, and can now move down;
@ -285,6 +292,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
if (opts.onDisableMoveDown) opts.onDisableMoveDown(member);
if (opts.onEnableMoveDown) opts.onEnableMoveDown(swappedMember);
}
if (oldIndex === 0) {
/*
member was previously the first member, and can now move up;

Wyświetl plik

@ -13,22 +13,22 @@
self.inner = $('.stream-menu-inner', self.container);
self.blocklist = $('ul', self.inner);
if(self.container.hasClass('stream-menu-closed')){
self.inner.css('height',0);
if (self.container.hasClass('stream-menu-closed')) {
self.inner.css('height', 0);
}
self.show = function(){
self.inner.animate({height: self.blocklist.outerHeight()}, 250, 'swing', function(){
self.show = function() {
self.inner.animate({height: self.blocklist.outerHeight()}, 250, 'swing', function() {
$(this).height('auto');
});
self.container.removeClass('stream-menu-closed');
};
self.hide = function(){
self.hide = function() {
self.inner.animate({height: 0}, 250)
self.container.addClass('stream-menu-closed');
};
self.toggle = function(){
if(self.container.hasClass('stream-menu-closed')){
self.toggle = function() {
if (self.container.hasClass('stream-menu-closed')) {
self.show();
} else {
self.hide();
@ -36,7 +36,7 @@
};
/* set up show/hide on click behaviour */
self.container.click(function(e){
self.container.click(function(e) {
e.preventDefault();
self.toggle();
});

Wyświetl plik

@ -1,36 +1,36 @@
/* generic function for adding a message to message area through JS alone */
function addMessage(status,text){
function addMessage(status, text) {
$('.messages').addClass('new').empty().append('<ul><li class="' + status + '">' + text + '</li></ul>');
var addMsgTimeout = setTimeout(function(){
var addMsgTimeout = setTimeout(function() {
$('.messages').addClass('appear');
clearTimeout(addMsgTimeout);
}, 100);
}
$(function(){
$(function() {
// Add class to the body from which transitions may be hung so they don't appear to transition as the page loads
$('body').addClass('ready');
// Enable toggle to open/close nav
$(document).on('click', '#nav-toggle', function(){
$(document).on('click', '#nav-toggle', function() {
$('body').toggleClass('nav-open');
if(!$('body').hasClass('nav-open')){
if (!$('body').hasClass('nav-open')) {
$('body').addClass('nav-closed');
}else{
} else {
$('body').removeClass('nav-closed');
}
});
// Resize nav to fit height of window. This is an unimportant bell/whistle to make it look nice
var fitNav = function(){
$('.nav-wrapper').css('min-height',$(window).height());
$('.nav-main').each(function(){
var fitNav = function() {
$('.nav-wrapper').css('min-height', $(window).height());
$('.nav-main').each(function() {
var thisHeight = $(this).height();
var footerHeight = $('.footer', $(this)).height();
});
};
fitNav();
$(window).resize(function(){
$(window).resize(function() {
fitNav();
});
@ -39,28 +39,28 @@ $(function(){
// $('.page-editor textarea').autosize();
// Enable nice focus effects on all fields. This enables help text on hover.
$(document).on('focus mouseover', 'input,textarea,select', function(){
$(document).on('focus mouseover', 'input,textarea,select', function() {
$(this).closest('.field').addClass('focused');
$(this).closest('fieldset').addClass('focused');
$(this).closest('li').addClass('focused');
});
$(document).on('blur mouseout', 'input,textarea,select', function(){
$(document).on('blur mouseout', 'input,textarea,select', function() {
$(this).closest('.field').removeClass('focused');
$(this).closest('fieldset').removeClass('focused');
$(this).closest('li').removeClass('focused');
});
/* tabs */
$(document).on('click', '.tab-nav a', function (e) {
$(document).on('click', '.tab-nav a', function(e) {
e.preventDefault();
$(this).tab('show');
});
$(document).on('click', '.tab-toggle', function(e){
$(document).on('click', '.tab-toggle', function(e) {
e.preventDefault();
$('.tab-nav a[href="'+ $(this).attr('href') +'"]').click();
$('.tab-nav a[href="' + $(this).attr('href') + '"]').click();
});
$('.dropdown-toggle').bind('click', function(){
$('.dropdown-toggle').bind('click', function() {
$(this).closest('.dropdown').toggleClass('open');
// Stop event propagating so the "close all dropdowns on body clicks" code (below) doesn't immediately close the dropdown
@ -68,22 +68,22 @@ $(function(){
});
/* close all dropdowns on body clicks */
$(document).on('click', function(e){
$(document).on('click', function(e) {
var relTarg = e.relatedTarget || e.toElement;
if(!$(relTarg).hasClass('dropdown-toggle')){
if (!$(relTarg).hasClass('dropdown-toggle')) {
$('.dropdown').removeClass('open');
}
});
/* Dropzones */
$('.drop-zone').on('dragover', function(){
$('.drop-zone').on('dragover', function() {
$(this).addClass('hovered');
}).on('dragleave dragend drop', function(){
}).on('dragleave dragend drop', function() {
$(this).removeClass('hovered');
});
/* Header search behaviour */
if(window.headerSearch){
if (window.headerSearch) {
var search_current_index = 0;
var search_next_index = 0;
@ -96,7 +96,7 @@ $(function(){
// auto focus on search box
$(window.headerSearch.termInput).trigger('focus');
function search () {
function search() {
var workingClasses = "icon-spinner";
$(window.headerSearch.termInput).parent().addClass(workingClasses);
@ -112,7 +112,7 @@ $(function(){
window.history.pushState(null, "Search results", "?q=" + $(window.headerSearch.termInput).val());
}
},
complete: function(){
complete: function() {
$(window.headerSearch.termInput).parent().removeClass(workingClasses);
}
});

Wyświetl plik

@ -24,7 +24,6 @@ function buildExpandingFormset(prefix, opts) {
opts.onAdd(formCount);
}
formCount++;
totalFormsInput.val(formCount);
});

Wyświetl plik

@ -1,41 +1,42 @@
$(function(){
$(function() {
var $explorer = $('#explorer');
var $body = $('body');
// Dynamically load menu on request.
$(document).on('click', '.dl-trigger', function(){
$(document).on('click', '.dl-trigger', function() {
var $this = $(this);
// Close all submenus
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')){
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')) {
// if it's already open, allow the menu plugin to close it
return false;
}else{
if(!$explorer.children().length){
} else {
if (!$explorer.children().length) {
$this.addClass('icon-spinner');
$explorer.load($this.data('explorer-menu-url'), function() {
$this.removeClass('icon-spinner');
$explorer.addClass('dl-menuwrapper').dlmenu({
animationClasses : {
classin : 'dl-animate-in-2',
classout : 'dl-animate-out-2'
animationClasses: {
classin: 'dl-animate-in-2',
classout: 'dl-animate-out-2'
}
});
$explorer.dlmenu('openMenu');
});
}else{
} else {
$explorer.dlmenu('openMenu');
}
}
return false;
});
// Close menu on ESC key
$(document).on('keydown click', function(e){
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen') && (e.keyCode == 27 || !e.keyCode)){
$(document).on('keydown click', function(e) {
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen') && (e.keyCode == 27 || !e.keyCode)) {
$explorer.dlmenu('closeMenu');
}
});

Wyświetl plik

@ -1,31 +1,31 @@
// Generated by CoffeeScript 1.6.2
(function() {
(function(jQuery) {
return jQuery.widget("IKS.hallohr", {
options: {
editable: null,
toolbar: null,
uuid: '',
buttonCssClass: null
},
populateToolbar: function(toolbar) {
var buttonElement, buttonset;
(function(jQuery) {
return jQuery.widget("IKS.hallohr", {
options: {
editable: null,
toolbar: null,
uuid: '',
buttonCssClass: null
},
populateToolbar: function(toolbar) {
var buttonElement, buttonset;
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>");
buttonElement = jQuery('<span></span>');
buttonElement.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: "Horizontal rule",
command: "insertHorizontalRule",
icon: "icon-horizontalrule",
cssClass: this.options.buttonCssClass
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>");
buttonElement = jQuery('<span></span>');
buttonElement.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: "Horizontal rule",
command: "insertHorizontalRule",
icon: "icon-horizontalrule",
cssClass: this.options.buttonCssClass
});
buttonset.append(buttonElement);
buttonset.hallobuttonset();
return toolbar.append(buttonset);
}
});
buttonset.append(buttonElement);
buttonset.hallobuttonset();
return toolbar.append(buttonset);
}
});
})(jQuery);
})(jQuery);
}).call(this);
}).call(this);

Wyświetl plik

@ -1,17 +1,17 @@
(function() {
(function(jQuery) {
return jQuery.widget("IKS.hallorequireparagraphs", {
options: {
editable: null,
uuid: '',
blockElements: ["dd", "div", "dl", "figure", "form", "ul", "ol", "table", "p", "h1", "h2", "h3", "h4", "h5", "h6"]
},
cleanupContentClone: function(el) {
// if the editable element contains no block-level elements wrap the contents in a <P>
if(el.html().length && !jQuery(this.options.blockElements.toString(), el).length){
this.options.editable.execute('formatBlock', 'p');
}
}
});
})(jQuery);
}).call(this);
(function(jQuery) {
return jQuery.widget("IKS.hallorequireparagraphs", {
options: {
editable: null,
uuid: '',
blockElements: ["dd", "div", "dl", "figure", "form", "ul", "ol", "table", "p", "h1", "h2", "h3", "h4", "h5", "h6"]
},
cleanupContentClone: function(el) {
// if the editable element contains no block-level elements wrap the contents in a <P>
if (el.html().length && !jQuery(this.options.blockElements.toString(), el).length) {
this.options.editable.execute('formatBlock', 'p');
}
}
});
})(jQuery);
}).call(this);

Wyświetl plik

@ -1,74 +1,77 @@
// Generated by CoffeeScript 1.6.2
(function() {
(function($) {
return $.widget("IKS.hallowagtaillink", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, getEnclosingLink, widget;
(function($) {
return $.widget("IKS.hallowagtaillink", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, getEnclosingLink, widget;
widget = this;
getEnclosingLink = function() {
var node;
widget = this;
getEnclosingLink = function() {
var node;
node = widget.options.editable.getSelection().commonAncestorContainer;
return $(node).parents('a').get(0);
};
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Links',
icon: 'icon-link',
command: null,
queryState: function(event) {
return button.hallobutton('checked', !!getEnclosingLink());
}
});
toolbar.append(button);
return button.on("click", function(event) {
var enclosingLink, lastSelection, url;
node = widget.options.editable.getSelection().commonAncestorContainer;
return $(node).parents('a').get(0);
};
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Links',
icon: 'icon-link',
command: null,
queryState: function(event) {
return button.hallobutton('checked', !!getEnclosingLink());
}
});
toolbar.append(button);
return button.on("click", function(event) {
var enclosingLink, lastSelection, url;
enclosingLink = getEnclosingLink();
if (enclosingLink) {
$(enclosingLink).replaceWith(enclosingLink.innerHTML);
button.hallobutton('checked', false);
return widget.options.editable.element.trigger('change');
} else {
lastSelection = widget.options.editable.getSelection();
if (lastSelection.collapsed) {
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true';
} else {
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true';
enclosingLink = getEnclosingLink();
if (enclosingLink) {
$(enclosingLink).replaceWith(enclosingLink.innerHTML);
button.hallobutton('checked', false);
return widget.options.editable.element.trigger('change');
} else {
lastSelection = widget.options.editable.getSelection();
if (lastSelection.collapsed) {
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true';
} else {
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true';
}
return ModalWorkflow({
url: url,
responses: {
pageChosen: function(pageData) {
var a;
a = document.createElement('a');
a.setAttribute('href', pageData.url);
if (pageData.id) {
a.setAttribute('data-id', pageData.id);
a.setAttribute('data-linktype', 'page');
}
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
lastSelection.surroundContents(a);
} else {
a.appendChild(document.createTextNode(pageData.title));
lastSelection.insertNode(a);
}
return widget.options.editable.element.trigger('change');
}
}
});
}
});
}
return ModalWorkflow({
url: url,
responses: {
pageChosen: function(pageData) {
var a;
a = document.createElement('a');
a.setAttribute('href', pageData.url);
if (pageData.id) {
a.setAttribute('data-id', pageData.id);
a.setAttribute('data-linktype', 'page');
}
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
lastSelection.surroundContents(a);
} else {
a.appendChild(document.createTextNode(pageData.title));
lastSelection.insertNode(a);
}
return widget.options.editable.element.trigger('change');
}
}
});
}
});
}
});
})(jQuery);
})(jQuery);
}).call(this);
}).call(this);

Wyświetl plik

@ -62,6 +62,7 @@ function ModalWorkflow(opts) {
self.body.html(response.html);
container.modal('show');
}
if (response.onload) {
// if the response is a function
response.onload(self);

Wyświetl plik

@ -9,6 +9,7 @@ function createPageChooser(id, pageType, openAtParentId) {
if (openAtParentId) {
initialUrl += openAtParentId + '/';
}
ModalWorkflow({
'url': initialUrl,
'urlParams': {'page_type': pageType},

Wyświetl plik

@ -127,6 +127,7 @@ function initTagField(id, autocompleteUrl) {
if (val && val[0] != '"' && val.indexOf(' ') > -1) {
return '"' + val + '"';
}
return val;
}
});
@ -135,15 +136,15 @@ function initTagField(id, autocompleteUrl) {
function InlinePanel(opts) {
var self = {};
self.setHasContent = function(){
if($('> li', self.formsUl).not(".deleted").length){
self.setHasContent = function() {
if ($('> li', self.formsUl).not(".deleted").length) {
self.formsUl.parent().removeClass('empty');
}else{
} else {
self.formsUl.parent().addClass('empty');
}
};
self.initChildControls = function (prefix) {
self.initChildControls = function(prefix) {
var childId = 'inline_child_' + prefix;
var deleteInputId = 'id_' + prefix + '-DELETE';
@ -205,7 +206,7 @@ function InlinePanel(opts) {
/* Hide container on page load if it is marked as deleted. Remove the error
message so that it doesn't count towards the number of errors on the tab at the
top of the page. */
if ($('#' + deleteInputId).val() === "1" ) {
if ($('#' + deleteInputId).val() === "1") {
$('#' + childId).addClass('deleted').hide(0, function() {
self.updateMoveButtonDisabledStates();
self.setHasContent();
@ -226,7 +227,7 @@ function InlinePanel(opts) {
}
};
self.animateSwap = function(item1, item2){
self.animateSwap = function(item1, item2) {
var parent = self.formsUl;
var children = parent.children('li:visible');
@ -234,7 +235,7 @@ function InlinePanel(opts) {
// Also set it's relatively calculated height to be an absolute one, to prevent the container collapsing while its children go absolute
parent.addClass('moving').css('height', parent.height());
children.each(function(){
children.each(function() {
// console.log($(this));
$(this).css('top', $(this).position().top);
}).addClass('moving');
@ -242,13 +243,13 @@ function InlinePanel(opts) {
// animate swapping around
item1.animate({
top:item2.position().top
}, 200, function(){
}, 200, function() {
parent.removeClass('moving').removeAttr('style');
children.removeClass('moving').removeAttr('style');
});
item2.animate({
top:item1.position().top
}, 200, function(){
}, 200, function() {
parent.removeClass('moving').removeAttr('style');
children.removeClass('moving').removeAttr('style');
});
@ -264,6 +265,7 @@ function InlinePanel(opts) {
to ensure it's *greater* than previous item */
$('#id_' + newChildPrefix + '-ORDER').val(formCount + 1);
}
self.updateMoveButtonDisabledStates();
if (opts.onAdd) opts.onAdd();
@ -273,66 +275,67 @@ function InlinePanel(opts) {
return self;
}
function cleanForSlug(val, useURLify){
if(URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it.
function cleanForSlug(val, useURLify) {
if (URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it.
return URLify(val, val.length);
} else { // If not just do the "replace"
return val.replace(/\s/g,"-").replace(/[^A-Za-z0-9\-]/g,"").toLowerCase();
return val.replace(/\s/g, "-").replace(/[^A-Za-z0-9\-]/g, "").toLowerCase();
}
}
function initSlugAutoPopulate(){
$('#id_title').on('focus', function(){
function initSlugAutoPopulate() {
$('#id_title').on('focus', function() {
$('#id_slug').data('previous-val', $('#id_slug').val());
$(this).data('previous-val', $(this).val());
});
$('#id_title').on('keyup keydown keypress blur', function(){
if($('body').hasClass('create') || (!$('#id_slug').data('previous-val').length || cleanForSlug($('#id_title').data('previous-val')) === $('#id_slug').data('previous-val'))){
$('#id_title').on('keyup keydown keypress blur', function() {
if ($('body').hasClass('create') || (!$('#id_slug').data('previous-val').length || cleanForSlug($('#id_title').data('previous-val')) === $('#id_slug').data('previous-val'))) {
// only update slug if the page is being created from scratch, if slug is completely blank, or if title and slug prior to typing were identical
$('#id_slug').val(cleanForSlug($('#id_title').val()));
}
});
}
function initSlugCleaning(){
$('#id_slug').blur(function(){
function initSlugCleaning() {
$('#id_slug').blur(function() {
// if a user has just set the slug themselves, don't remove stop words etc, just illegal characters
$(this).val(cleanForSlug($(this).val(), false));
});
}
function initErrorDetection(){
function initErrorDetection() {
var errorSections = {};
// first count up all the errors
$('.error-message').each(function(){
$('.error-message').each(function() {
var parentSection = $(this).closest('section');
if(!errorSections[parentSection.attr('id')]){
if (!errorSections[parentSection.attr('id')]) {
errorSections[parentSection.attr('id')] = 0;
}
errorSections[parentSection.attr('id')] = errorSections[parentSection.attr('id')]+1;
errorSections[parentSection.attr('id')] = errorSections[parentSection.attr('id')] + 1;
});
// now identify them on each tab
for(var index in errorSections) {
$('.tab-nav a[href=#'+ index +']').addClass('errors').attr('data-count', errorSections[index]);
for (var index in errorSections) {
$('.tab-nav a[href=#' + index + ']').addClass('errors').attr('data-count', errorSections[index]);
}
}
function initCollapsibleBlocks(){
$(".object.multi-field.collapsible").each(function(){
function initCollapsibleBlocks() {
$(".object.multi-field.collapsible").each(function() {
var $li = $(this);
var $fieldset = $li.find("fieldset");
if($li.hasClass("collapsed")){
if ($li.hasClass("collapsed")) {
$fieldset.hide();
}
$li.find("h2").click(function(){
if(!$li.hasClass("collapsed")){
$li.find("h2").click(function() {
if (!$li.hasClass("collapsed")) {
$li.addClass("collapsed");
$fieldset.hide("slow");
}else{
} else {
$li.removeClass("collapsed");
$fieldset.show("show");
}
@ -356,22 +359,22 @@ $(function() {
e.preventDefault();
var $this = $(this);
if(previewWindow){
if (previewWindow) {
previewWindow.close();
}
previewWindow = window.open($this.data('placeholder'), $this.data('windowname'));
if(/MSIE/.test(navigator.userAgent)){
if (/MSIE/.test(navigator.userAgent)) {
// If IE, load contents immediately without fancy effects
submitPreview.call($this, false);
} else {
previewWindow.onload = function(){
previewWindow.onload = function() {
submitPreview.call($this, true);
}
}
function submitPreview(enhanced){
function submitPreview(enhanced) {
var previewDoc = previewWindow.document;
$.ajax({
@ -380,7 +383,7 @@ $(function() {
data: $('#page-edit-form').serialize(),
success: function(data, textStatus, request) {
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
if(enhanced){
if (enhanced) {
var frame = previewDoc.getElementById('preview-frame');
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
@ -388,10 +391,12 @@ $(function() {
frame.document.write(data);
frame.document.close();
var hideTimeout = setTimeout(function(){
var hideTimeout = setTimeout(function() {
previewDoc.getElementById('loading-spinner-wrapper').className += ' remove';
clearTimeout(hideTimeout);
}) // just enough to give effect without adding discernible slowness
})
// just enough to give effect without adding discernible slowness
} else {
previewDoc.open();
previewDoc.write(data);

Wyświetl plik

@ -1,16 +1,16 @@
$(function(){
$(function() {
var $explorer = $('#explorer');
$('.nav-main .submenu-trigger').on('click', function(){
if($(this).closest('li').find('.nav-submenu').length){
$('.nav-main .submenu-trigger').on('click', function() {
if ($(this).closest('li').find('.nav-submenu').length) {
// Close explorer menu, although it may not be instantiated yet
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')){
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')) {
$explorer.dlmenu('closeMenu');
}
// Close other active submenus first, if any
if($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')){
if ($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')) {
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
}
@ -20,8 +20,8 @@ $(function(){
}
});
$(document).on('keydown click', function(e){
if($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)){
$(document).on('keydown click', function(e) {
if ($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)) {
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
}
});

Wyświetl plik

@ -1,17 +1,17 @@
"use strict";
document.addEventListener('DOMContentLoaded', function(){
document.addEventListener('DOMContentLoaded', function() {
var body = document.querySelectorAll('body')[0];
var nav = document.querySelectorAll('nav')[0];
var className = 'ready';
var has_pm = window.postMessage;
if(has_pm){
if (has_pm) {
parent.postMessage("fh=" + nav.offsetHeight, '*');
}
if (body.classList){
if (body.classList) {
body.classList.add(className);
}else{
} else {
body.className += ' ' + className;
}
});
});

Wyświetl plik

@ -1,29 +1,29 @@
(function(w,d){
(function(w, d) {
"use strict";
var l, f, t, frame_height;
function callback(e){
function callback(e) {
var h;
if(e.origin !== w.wagtail.userbar.origin){return;};
if (e.origin !== w.wagtail.userbar.origin) {return;};
// Get the height from the passed data.
try{
h = Number(e.data.replace( /.*fh=(\d+)(?:&|$)/, '$1' ) );
if (!isNaN( h ) && h > 0 && h !== frame_height) {
try {
h = Number(e.data.replace(/.*fh=(\d+)(?:&|$)/, '$1'));
if (!isNaN(h) && h > 0 && h !== frame_height) {
f.style.opacity = 1;
f.style.height = h + "px";
}
} catch(e){}
} catch (e) {}
}
if(!w.wagtail) return;
if (!w.wagtail) return;
if(w.postMessage){
if (w.postMessage) {
if (w.addEventListener) {
w.addEventListener('message', callback, false);
} else {
w.attachEvent('onmessage', callback );
w.attachEvent('onmessage', callback);
}
}
@ -39,11 +39,11 @@
f.src = w.wagtail.userbar.src;
// if postMessage is supported, hide iframe till it is loaded
if(w.postMessage){
f.style.opacity=0;
if (w.postMessage) {
f.style.opacity = 0;
}
t = d.getElementsByTagName('title')[0];
t.parentNode.insertBefore(l, t.nextSibling);
d.body.appendChild(f);
}(window,document));
}(window, document));

Wyświetl plik

@ -1,51 +1,52 @@
// Generated by CoffeeScript 1.6.2
(function() {
(function($) {
return $.widget("IKS.hallowagtaildoclink", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
(function($) {
return $.widget("IKS.hallowagtaildoclink", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Documents',
icon: 'icon-file-text-alt',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var lastSelection;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Documents',
icon: 'icon-file-text-alt',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var lastSelection;
lastSelection = widget.options.editable.getSelection();
return ModalWorkflow({
url: window.chooserUrls.documentChooser,
responses: {
documentChosen: function(docData) {
var a;
lastSelection = widget.options.editable.getSelection();
return ModalWorkflow({
url: window.chooserUrls.documentChooser,
responses: {
documentChosen: function(docData) {
var a;
a = document.createElement('a');
a.setAttribute('href', docData.url);
a.setAttribute('data-id', docData.id);
a.setAttribute('data-linktype', 'document');
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
lastSelection.surroundContents(a);
} else {
a.appendChild(document.createTextNode(docData.title));
lastSelection.insertNode(a);
}
return widget.options.editable.element.trigger('change');
}
a = document.createElement('a');
a.setAttribute('href', docData.url);
a.setAttribute('data-id', docData.id);
a.setAttribute('data-linktype', 'document');
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
lastSelection.surroundContents(a);
} else {
a.appendChild(document.createTextNode(docData.title));
lastSelection.insertNode(a);
}
return widget.options.editable.element.trigger('change');
}
}
});
});
}
});
});
}
});
})(jQuery);
})(jQuery);
}).call(this);
}).call(this);

Wyświetl plik

@ -1,47 +1,48 @@
// Generated by CoffeeScript 1.6.2
(function() {
(function($) {
return $.widget("IKS.hallowagtailembeds", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
(function($) {
return $.widget("IKS.hallowagtailembeds", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Embed',
icon: 'icon-media',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var insertionPoint, lastSelection;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Embed',
icon: 'icon-media',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var insertionPoint, lastSelection;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
return ModalWorkflow({
url: window.chooserUrls.embedsChooser,
responses: {
embedChosen: function(embedData) {
var elem;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
return ModalWorkflow({
url: window.chooserUrls.embedsChooser,
responses: {
embedChosen: function(embedData) {
var elem;
elem = $(embedData).get(0);
lastSelection.insertNode(elem);
if (elem.getAttribute('contenteditable') === 'false') {
insertRichTextDeleteControl(elem);
}
return widget.options.editable.element.trigger('change');
}
elem = $(embedData).get(0);
lastSelection.insertNode(elem);
if (elem.getAttribute('contenteditable') === 'false') {
insertRichTextDeleteControl(elem);
}
return widget.options.editable.element.trigger('change');
}
}
});
});
}
});
});
}
});
})(jQuery);
})(jQuery);
}).call(this);
}).call(this);

Wyświetl plik

@ -1,3 +1,3 @@
$(function(){
$(function() {
});
});

Wyświetl plik

@ -1,12 +1,12 @@
$(function(){
$(function() {
// Redirect users that don't support filereader
if(!$('html').hasClass('filereader')){
if (!$('html').hasClass('filereader')) {
document.location.href = window.fileupload_opts.simple_upload_url;
return false;
}
// prevents browser default drag/drop
$(document).bind('drop dragover', function (e) {
$(document).bind('drop dragover', function(e) {
e.preventDefault();
});
@ -24,7 +24,7 @@ $(function(){
acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types,
maxFileSize: window.fileupload_opts.errormessages.max_file_size
},
add: function (e, data) {
add: function(e, data) {
var $this = $(this);
var that = $this.data('blueimp-fileupload') || $this.data('fileupload')
var li = $($('#upload-list-item').html()).addClass('upload-uploading')
@ -33,27 +33,27 @@ $(function(){
$('#upload-list').append(li);
data.context = li;
data.process(function () {
data.process(function() {
return $this.fileupload('process', data);
}).always(function () {
}).always(function() {
data.context.removeClass('processing');
data.context.find('.left').each(function(index, elm){
data.context.find('.left').each(function(index, elm) {
$(elm).append(data.files[index].name);
});
data.context.find('.preview .thumb').each(function (index, elm) {
data.context.find('.preview .thumb').each(function(index, elm) {
$(elm).addClass('hasthumb')
$(elm).append(data.files[index].preview);
});
}).done(function () {
}).done(function() {
data.context.find('.start').prop('disabled', false);
if ((that._trigger('added', e, data) !== false) &&
(options.autoUpload || data.autoUpload) &&
data.autoUpload !== false) {
data.submit()
}
}).fail(function () {
}).fail(function() {
if (data.files.error) {
data.context.each(function (index) {
data.context.each(function(index) {
var error = data.files[index].error;
if (error) {
$(this).find('.error_messages').text(error);
@ -63,18 +63,18 @@ $(function(){
});
},
processfail: function(e, data){
processfail: function(e, data) {
var itemElement = $(data.context);
itemElement.removeClass('upload-uploading').addClass('upload-failure');
},
progress: function (e, data) {
progress: function(e, data) {
if (e.isDefaultPrevented()) {
return false;
}
var progress = Math.floor(data.loaded / data.total * 100);
data.context.each(function () {
data.context.each(function() {
$(this).find('.progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
'width',
progress + '%'
@ -82,23 +82,23 @@ $(function(){
});
},
progressall: function (e, data) {
progressall: function(e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
'width',
progress + '%'
).html(progress + '%');
if (progress >= 100){
$('#overall-progress').removeClass('active').find('.bar').css('width','0%');
if (progress >= 100) {
$('#overall-progress').removeClass('active').find('.bar').css('width', '0%');
}
},
done: function (e, data) {
done: function(e, data) {
var itemElement = $(data.context);
var response = $.parseJSON(data.result);
if(response.success){
if (response.success) {
itemElement.addClass('upload-success')
$('.right', itemElement).append(response.form);
@ -112,19 +112,19 @@ $(function(){
},
fail: function(e, data){
fail: function(e, data) {
var itemElement = $(data.context);
itemElement.addClass('upload-failure');
},
always: function(e, data){
always: function(e, data) {
var itemElement = $(data.context);
itemElement.removeClass('upload-uploading').addClass('upload-complete');
},
});
// ajax-enhance forms added on done()
$('#upload-list').on('submit', 'form', function(e){
$('#upload-list').on('submit', 'form', function(e) {
var form = $(this);
var itemElement = form.closest('#upload-list > li');
@ -132,16 +132,17 @@ $(function(){
$.post(this.action, form.serialize(), function(data) {
if (data.success) {
itemElement.slideUp(function(){$(this).remove()});
}else{
itemElement.slideUp(function() {$(this).remove()});
} else {
form.replaceWith(data.form);
// run tagit enhancement on new form
$('.tag_field input', form).tagit(window.tagit_opts);
}
});
});
$('#upload-list').on('click', '.delete', function(e){
$('#upload-list').on('click', '.delete', function(e) {
var form = $(this).closest('form');
var itemElement = form.closest('#upload-list > li');
@ -151,11 +152,11 @@ $(function(){
$.post(this.href, {csrfmiddlewaretoken: CSRFToken}, function(data) {
if (data.success) {
itemElement.slideUp(function(){$(this).remove()});
}else{
itemElement.slideUp(function() {$(this).remove()});
} else {
}
});
});
});
});

Wyświetl plik

@ -1,6 +1,6 @@
var jcropapi;
function setupJcrop(image, original, focalPointOriginal, fields){
function setupJcrop(image, original, focalPointOriginal, fields) {
image.Jcrop({
trueSize: [original.width, original.height],
bgColor: "rgb(192, 192, 192)",
@ -21,7 +21,7 @@ function setupJcrop(image, original, focalPointOriginal, fields){
fields.width.val(focalPointOriginal.width);
fields.height.val(focalPointOriginal.height);
},
}, function(){
}, function() {
jcropapi = this
});
}
@ -64,7 +64,7 @@ $(function() {
setupJcrop.apply(this, params)
$(window).resize($.debounce(300, function(){
$(window).resize($.debounce(300, function() {
// jcrop doesn't support responsive images so to cater for resizing the browser
// we have to destroy() it, which doesn't properly do it,
// so destory it some more, then re-apply it

Wyświetl plik

@ -1,47 +1,48 @@
// Generated by CoffeeScript 1.6.2
(function() {
(function($) {
return $.widget("IKS.hallowagtailimage", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
(function($) {
return $.widget("IKS.hallowagtailimage", {
options: {
uuid: '',
editable: null
},
populateToolbar: function(toolbar) {
var button, widget;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Images',
icon: 'icon-picture',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var insertionPoint, lastSelection;
widget = this;
button = $('<span></span>');
button.hallobutton({
uuid: this.options.uuid,
editable: this.options.editable,
label: 'Images',
icon: 'icon-picture',
command: null
});
toolbar.append(button);
return button.on("click", function(event) {
var insertionPoint, lastSelection;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
return ModalWorkflow({
url: window.chooserUrls.imageChooser + '?select_format=true',
responses: {
imageChosen: function(imageData) {
var elem;
lastSelection = widget.options.editable.getSelection();
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
return ModalWorkflow({
url: window.chooserUrls.imageChooser + '?select_format=true',
responses: {
imageChosen: function(imageData) {
var elem;
elem = $(imageData.html).get(0);
lastSelection.insertNode(elem);
if (elem.getAttribute('contenteditable') === 'false') {
insertRichTextDeleteControl(elem);
}
return widget.options.editable.element.trigger('change');
}
elem = $(imageData.html).get(0);
lastSelection.insertNode(elem);
if (elem.getAttribute('contenteditable') === 'false') {
insertRichTextDeleteControl(elem);
}
return widget.options.editable.element.trigger('change');
}
}
});
});
}
});
});
}
});
})(jQuery);
})(jQuery);
}).call(this);
}).call(this);

Wyświetl plik

@ -48,9 +48,9 @@ $(function() {
}
// Display note about scaled down images if image is large
if($widthField.val() > $(window).width()){
if ($widthField.val() > $(window).width()) {
$sizeNote.show();
}else{
} else {
$sizeNote.hide();
}

Wyświetl plik

@ -14,4 +14,4 @@ function createQueryChooser(id) {
}
});
});
}
}