UNPKG

pdfmark.js

Version:

Highlight keywords in pdfjs svg output. Based on mark.js.

49 lines (48 loc) 1.19 kB
<!doctype html> <html> <head> <meta charset="utf-8"> <title>mark.js manual test (dev purposes)</title> <style> mark { background: yellow; } </style> </head> <body> <div id="context"></div> <script src="../node_modules/jquery/dist/jquery.min.js"></script> <script src="../dist/mark.js"></script> <script> console.log(Mark); const $ctx = $("#context"); $ctx.load("fixtures/basic/main.html", function() { let start = new Date(), instance = new Mark($ctx.get()); console.log(instance); instance.mark("lorem", { debug: true, done: function(counter) { const end = new Date(), time = end.getTime() - start.getTime(); console.log( "Time elapsed: " + time + "ms.", "Elements: " + counter ); setTimeout(function() { start = new Date(); instance.unmark({ debug: true, done: function() { const end = new Date(), time = end.getTime() - start.getTime(); console.log("Time elapsed: " + time + "ms."); } }); }, 2000); } }); }); </script> </body> </html>