silverstripe-cms/javascript/SilverStripeNavigator.js
Naomi Guyer 639f6e4d95 NEW Side by side editing functionality - first cut (os#7412)
Introduces a preview window that appears when the screen is wide enough,
removes old preview button, adds a draft-public switch, adds variety of
preview options which are not hooked up yet.

Relies on sapphire's f95fadc84416835302fe6c8448054960b5e7ec65
2012-12-10 18:09:54 +01:00

30 lines
772 B
JavaScript

function windowName(suffix) {
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
return base + suffix;
}
(function($) {
$(document).ready(function() {
$('#switchView a.newWindow').on('click', function(e) {
var w = window.open(this.href, windowName(this.target));
w.focus();
return false;
});
$('#SilverStripeNavigatorLink').on('click', function(e) {
$('#SilverStripeNavigatorLinkPopup').toggle();
return false;
});
$('#SilverStripeNavigatorLinkPopup a.close').on('click', function(e) {
$('#SilverStripeNavigatorLinkPopup').hide();
return false;
});
$('#SilverStripeNavigatorLinkPopup input').on('focus',function(e) {
this.select();
});
});
})(jQuery);