Skip to content

Commit

Permalink
Remove inline JS and add LibreJS headers in JS files
Browse files Browse the repository at this point in the history
Fixes #33 (wow!)
Relates to #395
  • Loading branch information
ArthurHoaro committed Mar 12, 2017
1 parent 196808e commit b9b41d2
Show file tree
Hide file tree
Showing 14 changed files with 286 additions and 110 deletions.
4 changes: 4 additions & 0 deletions COPYING
Expand Up @@ -46,6 +46,10 @@ Files: plugins/wallabag/wallabag.png
License: MIT License (http://opensource.org/licenses/MIT)
Copyright: (C) 2015 Nicolas Lœuillet - https://github.com/wallabag/wallabag

Files: tpl/default/sad_star.png
License: MIT License (http://opensource.org/licenses/MIT)
Copyright: (C) 2015 kalvn - https://github.com/kalvn/Shaarli-Material

----------------------------------------------------
ZLIB/LIBPNG LICENSE

Expand Down
28 changes: 28 additions & 0 deletions inc/awesomplete-multiple-tags.js
@@ -1,3 +1,31 @@
/** @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
* (c) 2011-2017 The Shaarli Community, see AUTHORS
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

var awp = Awesomplete.$;
var autocompleteFields = document.querySelectorAll('input[data-multiple]');
[].forEach.call(autocompleteFields, function(autocompleteField) {
Expand Down
28 changes: 28 additions & 0 deletions inc/plugin_admin.js
@@ -1,3 +1,31 @@
/** @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
* (c) 2011-2017 The Shaarli Community, see AUTHORS
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

/**
* Change the position counter of a row.
*
Expand Down
28 changes: 28 additions & 0 deletions plugins/piwik/piwik.html
@@ -1,5 +1,33 @@
<!-- Piwik -->
<script type="text/javascript">
/** @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
* (c) 2011-2017 The Shaarli Community, see AUTHORS
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
Expand Down
28 changes: 28 additions & 0 deletions plugins/playvideos/youtube_playlist.js
@@ -1,3 +1,31 @@
/** @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
* (c) 2011-2017 The Shaarli Community, see AUTHORS
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

var run_playideos = (function () {
var e, n, t, o, r, i = [].indexOf || function (e) {
for (var n = 0, t = this.length; n < t; n++) {
Expand Down
28 changes: 28 additions & 0 deletions plugins/qrcode/shaarli-qrcode.js
@@ -1,3 +1,31 @@
/** @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net>
* (c) 2011-2017 The Shaarli Community, see AUTHORS
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must
* not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/

// Show the QR-Code of a permalink (when the QR-Code icon is clicked).
function showQrCode(caller,loading)
{
Expand Down
13 changes: 0 additions & 13 deletions tpl/default/configure.html
Expand Up @@ -222,19 +222,6 @@ <h2 class="window-title">{'Configure'|t}</h2>
</form>

{include="page.footer"}

<script>
(function (window, document) {
var toRemove = document.getElementById('timezone-remove');
var firstSelect = toRemove.getElementsByTagName('select')[0];
var secondSelect = toRemove.getElementsByTagName('select')[1];
toRemove.parentNode.removeChild(toRemove);
var toAdd = document.getElementById('timezone-add');
var newTimezone = '<span class="timezone-continent">Continent ' + firstSelect.outerHTML + '</span>';
newTimezone += ' <span class="timezone-country">Country ' + secondSelect.outerHTML + '</span>';
toAdd.innerHTML = newTimezone;
})(this, this.document);
</script>
</body>
</html>

28 changes: 6 additions & 22 deletions tpl/default/editlink.html
Expand Up @@ -4,11 +4,7 @@
{include="includes"}
</head>
<body>
{if="$source !== 'firefoxsocialapi' && $source !== 'bookmarklet'"}
{include="page.header"}
{else}
<div class="center">Shaare to: {$shaarlititle}</div>
{/if}
{include="page.header"}
<div id="editlinkform" class="pure-g">
<div class="pure-u-lg-1-5 pure-u-1-24"></div>
<form method="post" name="linkform" class="page-form pure-u-lg-3-5 pure-u-22-24 page-form page-form-light">
Expand All @@ -21,25 +17,25 @@ <h2 class="window-title">{'Shaare'|t}</h2>
<label for="lf_url">{'URL'|t}</label>
</div>
<div>
<input type="text" name="lf_url" id="lf_url" value="{$link.url}" class="lf_input">
<input type="text" name="lf_url" id="lf_url" value="{$link.url}" class="lf_input autofocus">
</div>
<div>
<label for="lf_title">{'Title'|t}</label>
</div>
<div>
<input type="text" name="lf_title" id="lf_title" value="{$link.title}" class="lf_input">
<input type="text" name="lf_title" id="lf_title" value="{$link.title}" class="lf_input autofocus">
</div>
<div>
<label for="lf_description">{'Description'|t}</label>
</div>
<div>
<textarea name="lf_description" id="lf_description">{$link.description}</textarea>
<textarea name="lf_description" id="lf_description" class="autofocus">{$link.description}</textarea>
</div>
<div>
<label for="lf_tags">{'Tags'|t}</label>
</div>
<div>
<input type="text" name="lf_tags" id="lf_tags" value="{$link.tags}" class="lf_input"
<input type="text" name="lf_tags" id="lf_tags" value="{$link.tags}" class="lf_input autofocus"
data-list="{loop="$tags"}{$key}, {/loop}" data-multiple autocomplete="off" >
</div>

Expand Down Expand Up @@ -74,18 +70,6 @@ <h2 class="window-title">{'Shaare'|t}</h2>
{/if}
</form>
</div>
{if="$source !== 'firefoxsocialapi' && $source !== 'bookmarklet'"}
{include="page.footer"}
{/if}
<script>
awesompleteUniqueTag('#lf_tags');
if (!document.linkform.lf_title.value) {
document.linkform.lf_title.focus();
} else if (!document.linkform.lf_description.value) {
document.linkform.lf_description.focus();
} else {
document.linkform.lf_tags.focus();
}
</script>
{include="page.footer"}
</body>
</html>
13 changes: 0 additions & 13 deletions tpl/default/install.html
Expand Up @@ -105,18 +105,5 @@ <h2 class="window-title">{'Install Shaarli'|t}</h2>
</div>
</form>
{include="page.footer"}
<script>
// FIXME!
(function (window, document) {
var toRemove = document.getElementById('timezone-remove');
var firstSelect = toRemove.getElementsByTagName('select')[0];
var secondSelect = toRemove.getElementsByTagName('select')[1];
toRemove.parentNode.removeChild(toRemove);
var toAdd = document.getElementById('timezone-add');
var newTimezone = '<span class="timezone-continent">Continent ' + firstSelect.outerHTML + '</span>';
newTimezone += ' <span class="timezone-country">Country ' + secondSelect.outerHTML + '</span>';
toAdd.innerHTML = newTimezone;
})(this, this.document);
</script>
</body>
</html>

0 comments on commit b9b41d2

Please sign in to comment.