1
0
Combine additional jquery/plugin files into one
Remove single file references
Moved dragdrop.js to serendipity_Editor.js.

Please test. Might make trouble in the installer/upgrader?
This commit is contained in:
Garvin Hicking
2014-06-25 12:28:59 +02:00
parent 7d127738ca
commit 33193806ed
18 changed files with 3351 additions and 63 deletions

View File

@ -4,6 +4,10 @@
Version 2.0-beta3 ()
------------------------------------------------------------------------
* Merged external JS libraries into a central "plugins.js" of the 2k11
backend template, can be updated through
templates/2k11/admin/js/gruntipity.php helper script.
* Adapted database table structure change for statistics, shoutbox,
karma and spamblock plugin (for new field definition of "ip" field)
Thanks to rohdef!

View File

@ -146,7 +146,6 @@
<a class="button_link" href="?serendipity[adminModule]=category&serendipity[adminAction]=view">{$CONST.BACK}</a>
<input class="standalone" name="SAVE" type="submit" value="{$save}">
</form>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{/if}
{if $view}
<h2>{$CONST.CATEGORIES}</h2>

View File

@ -182,6 +182,5 @@
<input name="serendipity[togglemoderate]" type="submit" value="{$CONST.APPROVE}">
</div>
</form>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{/if}
{/if}

View File

@ -149,9 +149,6 @@
{/if}
</form>
{if ! $use_popup}
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{/if}
{if $entry_vars.wysiwyg}
{foreach from=$entry_vars.wysiwyg_blocks item="wysiwyg_block_item" key="wysiwyg_block_jsname"}
{$wysiwyg_block_item|emit_htmlarea_code:$wysiwyg_block_jsname}

View File

@ -11,6 +11,7 @@
<![endif]-->
<script src="{serendipity_getFile file='admin/js/modernizr-2.8.2.min.js'}"></script>
{if $admin_vars.admin_installed}{serendipity_hookPlugin hook="backend_header" hookAll="true"}{/if}
<script src="{serendipity_getFile file='admin/js/plugins.js'}"></script>
<script src="{serendipity_getFile file='admin/serendipity_editor.js'}"></script>
<script src="{$head_link_script}"></script>
</head>

View File

@ -11,6 +11,7 @@
<![endif]-->
<script src="{serendipity_getFile file='admin/js/modernizr-2.8.2.min.js'}"></script>
<script src="{serendipity_getFile file='jquery.js'}"></script>
<script src="{serendipity_getFile file='admin/js/plugins.js'}"></script>
<script src="{serendipity_getFile file='admin/serendipity_editor.js'}"></script>
</head>
<body id="serendipity_admin_page">

View File

@ -1,32 +0,0 @@
$("document").ready(function() {
if (! Modernizr.touch){
function getDragdropConfiguration(group) {
return {
containerSelector: '.pluginmanager_container',
group: group,
handle: '.pluginmanager_grablet',
onDrop: function ($item, container, _super) {
var placement = $item.parents('.pluginmanager_container').data("placement");
$item.find('select[name$="placement]"]').val(placement);
$item.removeClass("dragged").removeAttr("style")
$("body").removeClass("dragging")
$.autoscroll.stop();
},
onDragStart: function ($item, container, _super) {
$.autoscroll.init();
$item.css({
height: $item.height(),
width: $item.width()
})
$item.addClass("dragged")
$("body").addClass("dragging")
}
}
}
$('.pluginmanager_sidebar .pluginmanager_container').sortable(getDragdropConfiguration('plugins_sidebar'));
$('.pluginmanager_event .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
$('.configuration_group .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
}
});

View File

@ -0,0 +1,57 @@
<?php
## HELPER SCRIPT ##
## Compiles actual minified (or not) external javascript libraries into a single one.
## This is like a grunt-task, but to make it easier to be executed by developers,
## this script is here.
##
##
## USAGE:
##
## php gruntipity.php
##
## Createa the file "plugins.js" which is then loaded by the template.
##
## If a new release of a plugin is to be incorporated (say a new release of jquery-autoscroll) you:
##
## 1. Download the minified version jquery-autoscroll.js and put it into this directory
## 2. Execute "php gruntipity.php"
## 3. The "plugins.js" file will get updated
## 4. Commit both plugins.js and jquery-autoscroll.js to the GIT repository
##
##
## If you want to add a new js plugin to the "plugins.js" you:
## 1. Download the minified version jquery-XXX.js and put it into this directory
## 2. Edit gruntipity.php, change the $files array and place the new jquery-XXX.js file at the place
## where it belongs, if order matters. If no order matters, put it at the end.
## 3. Execute "php gruntipity.php"
## 4. The "plugins.js" file will get updated
## 5. Add jquery-XXX.js to the GIT repository.
## 6. Commit changes of plugins.js, gruntipity.php and jqueryXXX.js to the GIT repository
##
$files = array(
'jquery.magnific-popup.js',
'jquery.syncheight.js',
'jquery.tabs.js',
'canvas-toBlob.js',
'jquery.autoscroll.js',
'jquery.sortable.js',
'jquery.cookie.js',
'jquery.details.js',
'accessifyhtml5.js'
);
echo "Merging js files into plugins.js...\n";
$plugins = '';
foreach($files AS $file) {
echo "* Adding $file (" . filesize($file) . " bytes, last changed " . date('Y-m-d H:i', filemtime($file)) . ")\n";
$plugins .= "// S9Y-MERGE START " . $file . " - " . date('Y-m-d H:i') . "\n"
. file_get_contents($file) . "\n"
. "// S9Y-MERGE END " . $file . " - " . date('Y-m-d H:i') . "\n";
}
$fp = fopen('plugins.js', 'w');
fwrite($fp, $plugins);
fclose($fp);
echo strlen($plugins) . " Bytes writte to plugins.js. Please commit changes.\n";

File diff suppressed because it is too large Load Diff

View File

@ -95,4 +95,3 @@
{/if}
</div>
<script src="{serendipity_getFile file='admin/js/jquery.syncheight.js'}"></script>

View File

@ -1,6 +1,3 @@
<script src="{serendipity_getFile file='admin/js/jquery.syncheight.js'}"></script>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
<div class="has_toolbar">
<h2>{$CONST.MEDIA_LIBRARY}</h2>

View File

@ -90,6 +90,3 @@
{/if}
</div>
</form>
<script src="{serendipity_getFile file='admin/js/jquery.cookie.js'}"></script>
<script src="{serendipity_getFile file='admin/js/jquery.tabs.js'}"></script>
<script src="{serendipity_getFile file='admin/js/canvas-toBlob.js'}"></script>

View File

@ -124,5 +124,3 @@
{serendipity_hookPlugin hook="backend_dashboard" hookAll="true"}
</div>
<script src="{serendipity_getFile file='admin/js/jquery.syncheight.js'}"></script>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>

View File

@ -33,9 +33,6 @@
{/if}
{* Those are only needed if the plugin contains a config item of type sequence, liek the entryproperty-plugin *}
<script src="{serendipity_getFile file="admin/js/jquery.autoscroll.js"}"></script>
<script src="{serendipity_getFile file="admin/js/jquery.sortable.js"}"></script>
<script src="{serendipity_getFile file="admin/js/dragdrop.js"}"></script>
{foreach $plugin_options_ungrouped as $plugin_option}
{if $plugin_option['ctype'] == 'seperator'}
{$plugin_option['config']}

View File

@ -38,9 +38,6 @@
{$formToken}
{$config}
</form>
{if ! $use_popup}
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{/if}
{elseif $adminAction == 'addnew'}
<h2>{if $type == 'event'}{$CONST.EVENT_PLUGINS}{else}{$CONST.SIDEBAR_PLUGINS}{/if}{if $only_group != UPGRADE} <span class="plugins_available">{$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$count_pluginstack}</span>{/if}</h2>
{foreach $errorstack as $e_idx => $e_name}
@ -142,7 +139,6 @@
{/foreach}
</ul>
{/foreach}
<script src="{serendipity_getFile file='admin/js/jquery.syncheight.js'}"></script>
{else}
<h2>{$CONST.CONFIGURE_PLUGINS}</h2>
{if $save}
@ -151,11 +147,6 @@
{if $new_plugin_failed}
<span class="msg_error"><span class="icon-attention-circled"></span> {$CONST.ERROR}: {$CONST.PLUGIN_ALREADY_INSTALLED}</span>
{/if}
<script src="{serendipity_getFile file="admin/js/jquery.autoscroll.js"}"></script>
<script src="{serendipity_getFile file="admin/js/jquery.sortable.js"}"></script>
<script src="{serendipity_getFile file="admin/js/dragdrop.js"}"></script>
<script src="{serendipity_getFile file="admin/js/jquery.cookie.js"}"></script>
<script src="{serendipity_getFile file="admin/js/jquery.tabs.js"}"></script>
<div class="tabs" id="pluginlist_tabs">
<section id="pluginlist_sidebar" class="panel">
<h3>{$CONST.SIDEBAR_PLUGINS}</h3>

View File

@ -1615,4 +1615,38 @@ $(function() {
serendipity_imageSelector_addToElement = function(str, id) {
return serendipity.serendipity_imageSelector_addToElement(str, id);
}
}
// former "dragdrop.js" file
$("document").ready(function() {
if (! Modernizr.touch){
function getDragdropConfiguration(group) {
return {
containerSelector: '.pluginmanager_container',
group: group,
handle: '.pluginmanager_grablet',
onDrop: function ($item, container, _super) {
var placement = $item.parents('.pluginmanager_container').data("placement");
$item.find('select[name$="placement]"]').val(placement);
$item.removeClass("dragged").removeAttr("style")
$("body").removeClass("dragging")
$.autoscroll.stop();
},
onDragStart: function ($item, container, _super) {
$.autoscroll.init();
$item.css({
height: $item.height(),
width: $item.width()
})
$item.addClass("dragged")
$("body").addClass("dragging")
}
}
}
$('.pluginmanager_sidebar .pluginmanager_container').sortable(getDragdropConfiguration('plugins_sidebar'));
$('.pluginmanager_event .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
$('.configuration_group .pluginmanager_container').sortable(getDragdropConfiguration('plugins_event'));
}
});

View File

@ -22,7 +22,6 @@
<p>{$CONST.STYLE_OPTIONS_NONE}</p>
{/if}
</section>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{else}
<section id="template_select" class="clearfix">
<h2>{$CONST.CURRENT_TEMPLATE}</h2>
@ -141,7 +140,4 @@
{/foreach}
</ul>
</section>
<script src="{serendipity_getFile file='admin/js/jquery.syncheight.js'}"></script>
<script src="{serendipity_getFile file='admin/js/jquery.magnific-popup.js'}"></script>
{/if}

View File

@ -12,6 +12,7 @@
<script src="{serendipity_getFile file='admin/js/modernizr-2.8.2.min.js'}"></script>
{if $admin_vars.admin_installed}{serendipity_hookPlugin hook="backend_header" hookAll="true"}{/if}
<script src="{$serendipityHTTPPath}{$templatePath}jquery.js"></script>
<script src="{serendipity_getFile file="admin/js/plugins.js}"></script>
<script src="{serendipity_getFile file='admin/serendipity_editor.js'}"></script>
</head>
<body id="serendipity_admin_page">