Move serendipiy_editor.js.tpl convertion into core

http://board.s9y.org/viewtopic.php?f=11&t=19927
This commit is contained in:
onli
2014-05-16 16:13:16 +02:00
parent 05817056e5
commit 694b446e1a
5 changed files with 33 additions and 21 deletions
@@ -1304,7 +1304,7 @@ $(function() {
}
// minify images before upload, approach taken from https://github.com/joelvardy/javascript-image-upload/
{if $uploadResize && ($maxImgWidth > 0 || $maxImgHeight > 0)}
{if {serendipity_getConfigVar key='uploadResize'} && ({serendipity_getConfigVar key='maxImgWidth'} > 0 || {serendipity_getConfigVar key='maxImgHeight'} > 0)}
if ($('#uploadform').length > 0) {
$('input[name="go_properties"]').hide();
var progressIcon = document.createElement('span');
@@ -1321,8 +1321,8 @@ $(function() {
var file = this.file;
image.onload = function (imageEvent) {
var canvas = document.createElement('canvas'),
max_width = {if $maxImgWidth}{$maxImgWidth}{else}0{/if},
max_height = {if $maxImgHeight}{$maxImgHeight}{else}0{/if},
max_width = {if {serendipity_getConfigVar key='maxImgWidth'}}{serendipity_getConfigVar key='maxImgWidth'}{else}0{/if},
max_height = {if {serendipity_getConfigVar key='maxImgHeight'}}{serendipity_getConfigVar key='maxImgHeight'}{else}0{/if},
width = image.width,
height = image.height;
-15
View File
@@ -108,21 +108,6 @@ serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $t
function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$addData) {
// Check what Event is coming in, only react to those we want.
switch($event) {
case 'external_plugin':
switch ($eventData) {
case 'admin/serendipity_editor.js':
header('Content-Type: application/javascript');
global $serendipity;
$data = array( 'token_url' => serendipity_setFormToken("url"),
'uploadResize' => $serendipity['uploadResize'],
'maxImgWidth' => $serendipity['maxImgWidth'],
'maxImgHeight' => $serendipity['maxImgHeight']
);
echo serendipity_smarty_show('admin/serendipity_editor.js.tpl', $data);
break;
}
break;
case 'js':
// always add newlines to the end of last element, in case of other plugins using this hook and
// always start at line Col 1, to populate the (virtual) serendipity.js file