]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - app/Resources/static/themes/material/index.js
Adds Webpack support and removes the use for Grunt
[github/wallabag/wallabag.git] / app / Resources / static / themes / material / index.js
similarity index 57%
rename from app/Resources/static/themes/material/js/init.js
rename to app/Resources/static/themes/material/index.js
index 0b2832c068fb4bcdc9d82e47f6f3a01392f18322..d6afbb8a32eba702d7a68e255608e02c30889e2c 100755 (executable)
@@ -1,21 +1,21 @@
-/* jQuery */
 import $ from 'jquery';
 
-/* Annotations */
-import annotator from 'annotator';
+/* Materialize imports */
+import 'materialize-css/dist/css/materialize.css';
+import 'materialize-css/dist/js/materialize';
+
+/* Global imports */
+import '../_global/index';
 
 /* Tools */
-import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools';
+import { initExport, initFilters } from './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
+import './js/shortcuts/main';
+import './js/shortcuts/entry';
 
-global.jQuery = $;
+/* Theme style */
+import './css/index.scss';
 
 $(document).ready(() => {
   // sideNav
@@ -30,6 +30,7 @@ $(document).ready(() => {
     formatSubmit: 'dd/mm/yyyy',
     hiddenName: true,
     format: 'dd/mm/yyyy',
+    container: 'body',
   });
   initFilters();
   initExport();
@@ -74,37 +75,4 @@ $(document).ready(() => {
     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);
-    });
-  }
 });