2016-03-08 16:02:34 +00:00
|
|
|
var $ = require("jquery"),
|
|
|
|
materialize = require("materialize");
|
|
|
|
var annotator = require('annotator');
|
|
|
|
|
2015-08-12 19:55:44 +00:00
|
|
|
function init_filters() {
|
|
|
|
// no display if filters not aviable
|
|
|
|
if ($("div").is("#filters")) {
|
|
|
|
$('#button_filters').show();
|
|
|
|
$('.button-collapse-right').sideNav({ edge: 'right' });
|
2015-08-17 18:12:11 +00:00
|
|
|
$('#clear_form_filters').on('click', function(){
|
2015-08-12 19:55:44 +00:00
|
|
|
$('#filters input').val('');
|
2015-08-20 13:59:47 +00:00
|
|
|
$('#filters :checked').removeAttr('checked');
|
2015-08-12 19:55:44 +00:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-15 18:06:59 +00:00
|
|
|
function init_export() {
|
|
|
|
// no display if export not aviable
|
|
|
|
if ($("div").is("#export")) {
|
|
|
|
$('#button_export').show();
|
|
|
|
$('.button-collapse-right').sideNav({ edge: 'right' });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-04 14:18:15 +00:00
|
|
|
$(document).ready(function(){
|
2015-08-04 16:39:26 +00:00
|
|
|
// sideNav
|
2015-08-04 14:18:15 +00:00
|
|
|
$('.button-collapse').sideNav();
|
2015-08-04 16:39:26 +00:00
|
|
|
$('select').material_select();
|
|
|
|
$('.collapsible').collapsible({
|
|
|
|
accordion : false
|
|
|
|
});
|
2015-08-17 00:12:14 +00:00
|
|
|
$('.datepicker').pickadate({
|
|
|
|
selectMonths: true,
|
|
|
|
selectYears: 15,
|
|
|
|
formatSubmit: 'dd/mm/yyyy',
|
|
|
|
hiddenName: true,
|
|
|
|
format: 'dd/mm/yyyy',
|
|
|
|
});
|
2015-08-12 19:55:44 +00:00
|
|
|
init_filters();
|
2015-10-15 18:06:59 +00:00
|
|
|
init_export();
|
2015-08-04 16:39:26 +00:00
|
|
|
|
2015-08-24 09:59:53 +00:00
|
|
|
$('#nav-btn-add-tag').on('click', function(){
|
|
|
|
$(".nav-panel-add-tag").toggle(100);
|
|
|
|
$(".nav-panel-menu").addClass('hidden');
|
|
|
|
$("#tag_label").focus();
|
|
|
|
return false;
|
|
|
|
});
|
2015-08-16 22:29:51 +00:00
|
|
|
$('#nav-btn-add').on('click', function(){
|
2015-08-12 06:22:30 +00:00
|
|
|
$(".nav-panel-buttom").hide(100);
|
|
|
|
$(".nav-panel-add").show(100);
|
|
|
|
$(".nav-panels .action").hide(100);
|
|
|
|
$(".nav-panel-menu").addClass('hidden');
|
|
|
|
$(".nav-panels").css('background', 'white');
|
|
|
|
$("#entry_url").focus();
|
|
|
|
return false;
|
|
|
|
});
|
2015-08-16 22:29:51 +00:00
|
|
|
$('#nav-btn-search').on('click', function(){
|
2015-08-04 16:39:26 +00:00
|
|
|
$(".nav-panel-buttom").hide(100);
|
|
|
|
$(".nav-panel-search").show(100);
|
2015-08-07 20:59:11 +00:00
|
|
|
$(".nav-panels .action").hide(100);
|
2015-08-06 01:22:45 +00:00
|
|
|
$(".nav-panel-menu").addClass('hidden');
|
2015-08-07 20:29:21 +00:00
|
|
|
$(".nav-panels").css('background', 'white');
|
2015-08-11 16:07:02 +00:00
|
|
|
$("#searchfield").focus();
|
2015-08-04 16:39:26 +00:00
|
|
|
return false;
|
|
|
|
});
|
2016-03-08 16:02:34 +00:00
|
|
|
$('.close').on('click', function(){
|
2015-08-04 16:39:26 +00:00
|
|
|
$(".nav-panel-add").hide(100);
|
|
|
|
$(".nav-panel-search").hide(100);
|
|
|
|
$(".nav-panel-buttom").show(100);
|
2015-08-07 20:59:11 +00:00
|
|
|
$(".nav-panels .action").show(100);
|
2015-08-06 01:22:45 +00:00
|
|
|
$(".nav-panel-menu").removeClass('hidden');
|
2015-08-07 20:29:21 +00:00
|
|
|
$(".nav-panels").css('background', 'transparent');
|
2015-08-04 16:39:26 +00:00
|
|
|
return false;
|
|
|
|
});
|
2015-08-16 22:50:46 +00:00
|
|
|
$(window).scroll(function () {
|
|
|
|
var s = $(window).scrollTop(),
|
|
|
|
d = $(document).height(),
|
|
|
|
c = $(window).height();
|
|
|
|
var scrollPercent = (s / (d-c)) * 100;
|
|
|
|
$(".progress .determinate").css('width', scrollPercent+'%');
|
|
|
|
});
|
2016-03-08 16:02:34 +00:00
|
|
|
|
|
|
|
/* ==========================================================================
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|
2015-08-11 16:07:02 +00:00
|
|
|
});
|