1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-12-01 05:24:11 +01:00

Move inline JS to external file

This commit is contained in:
Lukas Reschke 2013-01-22 20:44:40 +01:00
parent 2022d42052
commit e1a50b1737
3 changed files with 34 additions and 11 deletions

30
js/full_tags.php Normal file
View File

@ -0,0 +1,30 @@
<?php
/**
* Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
// Set the content type to Javascript
header("Content-type: text/javascript");
// Disallow caching
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$qtags = OC_Bookmarks_Bookmarks::findTags(array(), 0, 400);
$tags = array();
foreach($qtags as $tag) {
$tags[] = $tag['tag'];
}
?>
var fullTags = <?php echo json_encode($tags);?>;
$(document).ready(function() {
$('body').bookmark_dialog({
'on_success': function(){
self.close();
}
});
});

View File

@ -1,13 +1,7 @@
<form class="addBm" method="post" action="<?php echo OCP\Util::linkTo('bookmarks', 'ajax/editBookmark.php');?>"> <form class="addBm" method="post" action="<?php echo OCP\Util::linkTo('bookmarks', 'ajax/editBookmark.php');?>">
<?php if(!isset($embedded) || !$embedded):?> <?php if(!isset($embedded) || !$embedded):?>
<script type="text/javascript"> <script type="text/javascript" src="<?php echo OC_Helper::linkTo('bookmarks/js', 'full_tags.php');?>"></script>
var fullTags = <?php echo $_['tags'];?>;
$(document).ready(function() {
$('body').bookmark_dialog({
'on_success': function(){ self.close(); }
});
});
</script>
<h1><?php echo $l->t('Add a bookmark');?></h1> <h1><?php echo $l->t('Add a bookmark');?></h1>
<div class="close_btn"> <div class="close_btn">
<a href="javascript:self.close()" class="ui-icon ui-icon-closethick"> <a href="javascript:self.close()" class="ui-icon ui-icon-closethick">

View File

@ -59,9 +59,8 @@ function bookmarklet(){
</div> </div>
<div class="bookmarks_list"></div> <div class="bookmarks_list"></div>
</div> </div>
<script> <script type="text/javascript" src="<?php echo OC_Helper::linkTo('bookmarks/js', 'full_tags.php');?>"></script>
var fullTags = <?php echo $_['tags'];?>;
</script>
<script type="text/html" id="edit_dialog_tmpl"> <script type="text/html" id="edit_dialog_tmpl">
<?php require 'addBm.php';?> <?php require 'addBm.php';?>