]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/pages/page-show.js
Update/fix german translation
[bookstack] / resources / assets / js / pages / page-show.js
index 0f45e1987cf434959169128a0632692cc1937aa9..7754840af501dead6c215f6fd9fb8c74cf263bd8 100644 (file)
@@ -1,8 +1,11 @@
-"use strict";
-// Configure ZeroClipboard
-import Clipboard from "clipboard";
+const Clipboard = require("clipboard");
+const Code = require('../code');
 
-export default window.setupPageShow = function (pageId) {
+let setupPageShow = window.setupPageShow = function (pageId) {
+
+    Code.highlight();
+
+    if (!pageId) return;
 
     // Set up pointer
     let $pointer = $('#pointer').detach();
@@ -81,6 +84,12 @@ export default window.setupPageShow = function (pageId) {
             let $idElem = $(idElem);
             let color = $('#custom-styles').attr('data-color-light');
             $idElem.css('background-color', color).attr('data-highlighted', 'true').smoothScrollTo();
+            setTimeout(() => {
+                $idElem.addClass('anim').addClass('selectFade').css('background-color', '');
+                setTimeout(() => {
+                   $idElem.removeClass('selectFade');
+                }, 3000);
+            }, 100);
         } else {
             $('.page-content').find(':contains("' + text + '")').smoothScrollTo();
         }
@@ -150,4 +159,8 @@ export default window.setupPageShow = function (pageId) {
         }
     });
 
+    // in order to call from other places.
+    window.setupPageShow.goToText = goToText;
 };
+
+module.exports = setupPageShow;
\ No newline at end of file