624680bb93
- This is a first pass at getting a more logical structure. The focus is on moving from admin/frontend to client/server. - The location of the databases is highly important, this isn't expected to change again In the future - client/assets should probably become public/ - more stuff should be shared (helpers etc) - cleanup some confusion around tpl and views
69 lines
2.0 KiB
JavaScript
69 lines
2.0 KiB
JavaScript
// # Temporary Admin UI
|
||
|
||
/*global window, document, $ */
|
||
(function () {
|
||
"use strict";
|
||
|
||
// UTILS
|
||
|
||
/**
|
||
* Allows to check contents of each element exactly
|
||
* @param obj
|
||
* @param index
|
||
* @param meta
|
||
* @param stack
|
||
* @returns {boolean}
|
||
*/
|
||
$.expr[":"].containsExact = function (obj, index, meta, stack) {
|
||
return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
|
||
};
|
||
|
||
// Called on Window resize
|
||
$(window).resize(function () {
|
||
|
||
var loginContainer = $(".js-login-container"),
|
||
marginTop = Math.floor((loginContainer.parent().height() - loginContainer.height()) / 2) - 15;
|
||
loginContainer.css('margin-top', marginTop).delay(250).fadeIn(750);
|
||
|
||
});
|
||
|
||
// Allow notifications to be dismissed
|
||
$(document).on('click', '.js-notification .close', function () {
|
||
$(this).parent().fadeOut(200, function () { $(this).remove(); });
|
||
});
|
||
|
||
$(document).ready(function () {
|
||
|
||
// ## Set interactions for all menus
|
||
// This finds all visible '.overlay' elements and hides them upon clicking away from the element itself.
|
||
$("body").on('click', function (event) {
|
||
var $target = $(event.target);
|
||
if (!$target.parents().is(".overlay:visible") && !$target.is(".overlay:visible")) {
|
||
$("body").find(".overlay:visible").fadeOut();
|
||
}
|
||
});
|
||
|
||
// LOGIN SCREEN
|
||
|
||
$(window).resize();
|
||
|
||
// EDITOR / NOTIFICATIONS
|
||
|
||
$('.entry-content header, .entry-preview header').on('click', function () {
|
||
$('.entry-content, .entry-preview').removeClass('active');
|
||
$(this).closest('section').addClass('active');
|
||
});
|
||
|
||
$('.entry-title .icon-fullscreen').on('click', function (e) {
|
||
e.preventDefault();
|
||
$('body').toggleClass('fullscreen');
|
||
});
|
||
|
||
$('.options.up').on('click', function (e) {
|
||
e.stopPropagation();
|
||
$(this).next("ul").fadeToggle(200);
|
||
});
|
||
|
||
});
|
||
|
||
}()); |