blob: 1721ae41ab392ffc1bd64827586733a904f64479 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
var $ = global.jquery = require('jquery');
require('jquery.cookie');
require('jquery-ui');
var annotator = require('annotator');
$.fn.ready(function() {
var $listmode = $('#listmode'),
$listentries = $("#list-entries");
/* ==========================================================================
Menu
========================================================================== */
$("#menu").click(function(){
$("#links").toggleClass('menu--open');
if ($('#content').hasClass('opacity03')) {
$('#content').removeClass('opacity03');
}
});
/* ==========================================================================
List mode or Table Mode
========================================================================== */
$listmode.click(function(){
if ( jquery.cookie("listmode") == 1 ) {
// Cookie
$.removeCookie("listmode");
$listentries.removeClass("listmode");
$listmode.removeClass("tablemode");
$listmode.addClass("listmode");
}
else {
// Cookie
jquery.cookie("listmode", 1, {expires: 365});
$listentries.addClass("listmode");
$listmode.removeClass("listmode");
$listmode.addClass("tablemode");
}
});
/* ==========================================================================
Cookie listmode
========================================================================== */
if ( jquery.cookie("listmode") == 1 ) {
$listentries.addClass("listmode");
$listmode.removeClass("listmode");
$listmode.addClass("tablemode");
}
/* ==========================================================================
Add tag panel
========================================================================== */
$('#nav-btn-add-tag').on('click', function(){
$(".nav-panel-add-tag").toggle(100);
$(".nav-panel-menu").addClass('hidden');
$("#tag_label").focus();
return false;
});
/* ==========================================================================
Annotations & Remember position
========================================================================== */
if ($("article").length) {
var app = new annotator.App();
app.include(annotator.ui.main, {
element: document.querySelector('article')
});
var x = JSON.parse($('#annotationroutes').html());
app.include(annotator.storage.http, x);
app.start().then(function () {
app.annotations.load({entry: x.entryId});
});
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var scrollPercent = (scrollTop) / (docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100)/100;
savePercent(x.entryId, scrollPercentRounded);
});
retrievePercent(x.entryId);
$(window).resize(function(){
retrievePercent(x.entryId);
});
}
});
|