PrintMoqups

Make Moqups project printable. Free!

  1. // ==UserScript==
  2. // @name PrintMoqups
  3. // @version 0.5
  4. // @author FireAwayH
  5. // @namespace FireAwayH
  6. // @match https://app.moqups.com/*
  7. // @grant none
  8. // @description Make Moqups project printable. Free!
  9. // @run-at document-end
  10. // ==/UserScript==
  11. /* jshint -W097 */
  12. 'use strict';
  13.  
  14. var init = function(){
  15. var menu = document.getElementById("account-menu");
  16. var printIt = document.createElement("a");
  17. menu.appendChild(printIt);
  18. printIt.outerHTML = '<a href="#" class="upgrade-btn mq-btn" onclick="printIt();">print it</a>';
  19. var insertScript = document.createElement("script");
  20. insertScript.id = "printIt";
  21. insertScript.innerHTML =
  22. "var needPrint = $('.canvas-svg:eq(0)').find('svg:eq(0)')[0];\
  23. var insertStyle = $('link[rel=stylesheet]')[0];\
  24. var title = document.createElement('title');\
  25. var printIt = function(){\
  26. if(!needPrint){\
  27. needPrint = $('.canvas-svg:eq(0)').find('svg:eq(0)')[0];\
  28. }\
  29. var newWindow = window.open();\
  30. var titleText = $('title').html();\
  31. title.innerHTML = titleText;\
  32. newWindow.document.head.appendChild(insertStyle);\
  33. newWindow.document.head.appendChild(title);\
  34. newWindow.document.body.innerHTML = needPrint.outerHTML;\
  35. newWindow.document.body.setAttribute('style','overflow:scroll');\
  36. }\
  37. ";
  38.  
  39.  
  40. document.body.appendChild(insertScript);
  41. }
  42. init();