Completed
Push — stable8.2 ( 0ab132...8bdbd8 )
by Blizzz
9s
created

main.php ➔ bookmarklet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 9.6666
1
<?php
2
script('bookmarks', 'settings');
3
script('bookmarks', 'bookmarks');
4
style('bookmarks', 'bookmarks');
5
6
script('bookmarks', '3rdparty/tag-it');
7
script('bookmarks', '3rdparty/js_tpl');
8
style('bookmarks', '3rdparty/jquery.tagit');
9
10
/**
11
 * Copyright (c) 2011 Marvin Thomas Rabe <[email protected]>
12
 * Copyright (c) 2011 Arthur Schiwon <[email protected]>
13
 * This file is licensed under the Affero General Public License version 3 or
14
 * later.
15
 * See the COPYING-README file.
16
 */
17
$bookmarkleturl = $_['bookmarkleturl'];
18
$bookmarkletscript = bookmarklet($bookmarkleturl);
19
20
function bookmarklet($bookmarkleturl) {
21
	$l = new OC_l10n('bookmarks');
22
	$blet = "javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('";
23
	$blet .= $bookmarkleturl;
24
	$blet .= "?output=popup&url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=400px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();";
25
	$help_msg = $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:');
26
	$output = '<div id="bookmarklet_hint" class="bkm_hint">' . $help_msg . '</div><a class="button bookmarklet" href="' . $blet . '">' . $l->t('Add to ownCloud') . '</a>';
27
	return $output;
28
}
29
?>
30
31
<div id="app-navigation">
32
    <ul id="navigation-list">
33
        <li>
34
            <form id="add_form">
35
                <input type="text" id="add_url" value="" placeholder="<?php p($l->t('Address')); ?>"/>
36
                <button id="bookmark_add_submit" title="Add" class="icon-add"></button>
37
            </form>
38
            <p id="tag_filter" class="open">
39
                <input type="text" value="<?php if(isset($_['req_tag'])) p($_['req_tag']); else ""; ?>"/>
40
41
42
            </p>
43
            <input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_['req_tag'])) p($_['req_tag']); else ""; ?>" />
44
            <label id="tag_select_label"><?php p($l->t('Filterable Tags')); ?></label>
45
        </li>
46
        <li class="tag_list">
47
        </li>
48
    </ul>
49
50
    <div id="app-settings">
51
        <div id="app-settings-header">
52
            <button class="settings-button generalsettings" data-apps-slide-toggle="#app-settings-content" tabindex="0"></button>
53
        </div>
54
        <div id="app-settings-content">
55
56
57
			<?php require 'settings.php'; ?>
58
        </div>
59
    </div>
60
61
</div>
62
<div id="app-content">
63
    <div id="emptycontent" style="display: none;">
64
        <p class="title"><?php
65
			p($l->t('You have no bookmarks'));
66
			$embedded = true;
67
			print_unescaped($bookmarkletscript);
68
			?></p>
69
        <br/><br/>
70
71
72
        <div class="bkm_hint">
73
            <a href="#" id="firstrun_setting">
74
				<?php p($l->t('You can also import a bookmark file')); ?>
75
            </a></div>
76
    </div>
77
    <div class="bookmarks_list"></div>
78
</div>
79
80
<?php
81
require 'js_tpl.php';
82