0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/admin/assets/js/admin-ui-temp.js

64 lines
1.8 KiB
JavaScript
Raw Normal View History

2013-05-11 11:44:25 -05:00
// # Temporary Admin UI
2013-06-11 11:42:56 -05:00
/*global window, document, jQuery */
2013-05-11 11:44:25 -05:00
(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.round(($(window).height() / 2) - loginContainer.outerHeight());
loginContainer.css('margin-top', marginTop);
});
2013-05-11 11:44:25 -05:00
$(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();
}
});
2013-06-11 11:42:56 -05:00
// LOGIN SCREEN
$(window).resize();
2013-06-11 11:42:56 -05:00
2013-05-11 11:44:25 -05:00
// 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);
});
});
}(jQuery));