From a40029f9d6cf8405b6f3e30c8762a4f50da88db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 2 May 2017 16:21:06 +0200 Subject: Disabled shortcuts on login/register page --- app/Resources/static/themes/material/js/shortcuts/main.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/Resources/static/themes/material/js') diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js index 0a2d2a69..41499478 100644 --- a/app/Resources/static/themes/material/js/shortcuts/main.js +++ b/app/Resources/static/themes/material/js/shortcuts/main.js @@ -23,6 +23,11 @@ $(document).ready(() => { return; } + /* Show nothing on login/register page */ + if ($('#username').length > 0 || $('#fos_user_registration_form_username').length > 0) { + return; + } + /* Focus current card */ toggleFocus(card); -- cgit v1.2.3 From 64f81bc31699ed239e4becec1cfa7ebc0bef2b5a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 31 Mar 2017 20:21:41 +0200 Subject: Adds Webpack support and removes the use for Grunt Signed-off-by: Thomas Citharel use scss Signed-off-by: Thomas Citharel fix build, add babel, fix annotations fixes (and improvements !) for baggy add live reload & environments & eslint & theme fixes --- app/Resources/static/themes/material/js/init.js | 110 ----------------------- app/Resources/static/themes/material/js/tools.js | 24 +++++ 2 files changed, 24 insertions(+), 110 deletions(-) delete mode 100755 app/Resources/static/themes/material/js/init.js create mode 100644 app/Resources/static/themes/material/js/tools.js (limited to 'app/Resources/static/themes/material/js') diff --git a/app/Resources/static/themes/material/js/init.js b/app/Resources/static/themes/material/js/init.js deleted file mode 100755 index 0b2832c0..00000000 --- a/app/Resources/static/themes/material/js/init.js +++ /dev/null @@ -1,110 +0,0 @@ -/* jQuery */ -import $ from 'jquery'; - -/* Annotations */ -import annotator from 'annotator'; - -/* Tools */ -import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; - -/* Import shortcuts */ -import './shortcuts/main'; -import './shortcuts/entry'; -import '../../_global/js/shortcuts/main'; -import '../../_global/js/shortcuts/entry'; - -require('materialize'); // eslint-disable-line - -global.jQuery = $; - -$(document).ready(() => { - // sideNav - $('.button-collapse').sideNav(); - $('select').material_select(); - $('.collapsible').collapsible({ - accordion: false, - }); - $('.datepicker').pickadate({ - selectMonths: true, - selectYears: 15, - formatSubmit: 'dd/mm/yyyy', - hiddenName: true, - format: 'dd/mm/yyyy', - }); - initFilters(); - initExport(); - - $('#nav-btn-add-tag').on('click', () => { - $('.nav-panel-add-tag').toggle(100); - $('.nav-panel-menu').addClass('hidden'); - $('#tag_label').focus(); - return false; - }); - $('#nav-btn-add').on('click', () => { - $('.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; - }); - $('#nav-btn-search').on('click', () => { - $('.nav-panel-buttom').hide(100); - $('.nav-panel-search').show(100); - $('.nav-panels .action').hide(100); - $('.nav-panel-menu').addClass('hidden'); - $('.nav-panels').css('background', 'white'); - $('#search_entry_term').focus(); - return false; - }); - $('.close').on('click', () => { - $('.nav-panel-add').hide(100); - $('.nav-panel-search').hide(100); - $('.nav-panel-buttom').show(100); - $('.nav-panels .action').show(100); - $('.nav-panel-menu').removeClass('hidden'); - $('.nav-panels').css('background', 'transparent'); - return false; - }); - $(window).scroll(() => { - const s = $(window).scrollTop(); - const d = $(document).height(); - const c = $(window).height(); - const scrollPercent = (s / (d - c)) * 100; - $('.progress .determinate').css('width', `${scrollPercent}%`); - }); - -/* ========================================================================== - Annotations & Remember position - ========================================================================== */ - - if ($('article').length) { - const app = new annotator.App(); - const x = JSON.parse($('#annotationroutes').html()); - - app.include(annotator.ui.main, { - element: document.querySelector('article'), - }); - - app.include(annotator.storage.http, x); - - app.start().then(() => { - app.annotations.load({ entry: x.entryId }); - }); - - $(window).scroll(() => { - const scrollTop = $(window).scrollTop(); - const docHeight = $(document).height(); - const scrollPercent = (scrollTop) / (docHeight); - const scrollPercentRounded = Math.round(scrollPercent * 100) / 100; - savePercent(x.entryId, scrollPercentRounded); - }); - - retrievePercent(x.entryId); - - $(window).resize(() => { - retrievePercent(x.entryId); - }); - } -}); diff --git a/app/Resources/static/themes/material/js/tools.js b/app/Resources/static/themes/material/js/tools.js new file mode 100644 index 00000000..39398fd8 --- /dev/null +++ b/app/Resources/static/themes/material/js/tools.js @@ -0,0 +1,24 @@ +import $ from 'jquery'; + +function initFilters() { + // no display if filters not available + if ($('div').is('#filters')) { + $('#button_filters').show(); + $('.js-filters-action').sideNav({ edge: 'right' }); + $('#clear_form_filters').on('click', () => { + $('#filters input').val(''); + $('#filters :checked').removeAttr('checked'); + return false; + }); + } +} + +function initExport() { + // no display if export not available + if ($('div').is('#export')) { + $('#button_export').show(); + $('.js-export-action').sideNav({ edge: 'right' }); + } +} + +export { initExport, initFilters }; -- cgit v1.2.3 From 18e1da6277c4a5759384cfa66e0cd00afd7ce763 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 4 May 2017 14:56:52 +0200 Subject: rebase Signed-off-by: Thomas Citharel --- app/Resources/static/themes/material/js/shortcuts/main.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/Resources/static/themes/material/js') diff --git a/app/Resources/static/themes/material/js/shortcuts/main.js b/app/Resources/static/themes/material/js/shortcuts/main.js index 41499478..042b423c 100644 --- a/app/Resources/static/themes/material/js/shortcuts/main.js +++ b/app/Resources/static/themes/material/js/shortcuts/main.js @@ -28,6 +28,11 @@ $(document).ready(() => { return; } + /* Show nothing on login/register page */ + if ($('#username').length > 0 || $('#fos_user_registration_form_username').length > 0) { + return; + } + /* Focus current card */ toggleFocus(card); -- cgit v1.2.3