Merge branch 'master' of soutade.fr:dynastie

This commit is contained in:
Grégory Soutadé 2012-09-15 17:39:49 +02:00
commit 5447724607
1 changed files with 49 additions and 0 deletions

49
static/js/dynastie.js Normal file
View File

@ -0,0 +1,49 @@
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
editor_selector : "mceAdvanced",
encoding : "raw",
entities : "",
entity_encoding : "raw",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,charmap,emotions,iespell,media,advhr",
// theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
width: "100%",
height: "400"
});
// From http://planetozh.com/blog/2008/04/javascript-basename-and-dirname/
function basename(path) {
return path.replace(/\\/g,'/').replace( /.*\//, '' );
}
function previewPost()
{
var w = (screen.width * 80)/100;
var h = (screen.height * 80)/100;
var t = (screen.height - h) / 2;
var l = (screen.width - w) / 2;
var form = document.getElementById("previewForm");
var action = form.action;
var target = form.target;
var blog_id = basename(action);
form.action="/preview/" + blog_id;
form.target="PreviewPost";
window.open('/preview', 'PreviewPost', 'width=w, height=h, resizable=yes, scrollbars=yes, location=no, directories=no, status=yes, menubar=no, copyhistory=no, screenX=l, screenY=t');
form.submit();
form.action = action;
form.target = target;
}