No Description

config.js 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 'use strict';
  2. const autoHeightHtml0 = `<p style="font-weight: 400;font-style: normal;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;"><a href="https://github.com/iou90/react-native-autoheight-webview">Tags</a> are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. <span style="background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));">If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn't only tag the piece with "moving". I’d also use the <a href="http://x-squad.com">tags</a> "pets", "marriage", "career change", and "travel tips".</span></p>`;
  3. const autoHeightHtml1 = `Tags are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn’t only tag the piece with "moving".`;
  4. const style0 = `
  5. p {
  6. padding: 50px;
  7. box-sizing: border-box;
  8. }
  9. `;
  10. const style1 = `
  11. p {
  12. font-size: 12px !important;
  13. box-sizing: border-box;
  14. }
  15. `;
  16. const inlineBodyStyle = `
  17. body {
  18. display: inline-block;
  19. }
  20. `;
  21. //https://medium.com/@elhardoum/opening-external-links-in-browser-in-react-native-webview-18fe6a66312a
  22. const autoDetectLinkScript = `
  23. !function(){
  24. function isUrl(str){
  25. return str.startsWith('http');
  26. }
  27. var e=function(e,n,t){if(n=n.replace(/^on/g,""),"addEventListener"in window)e.addEventListener(n,t,!1);else if("attachEvent"in window)e.attachEvent("on"+n,t);else{var o=e["on"+n];e["on"+n]=o?function(e){o(e),t(e)}:t}return e},n=document.querySelectorAll("a[href]");if(n)for(var t in n)n.hasOwnProperty(t)&&e(n[t],"onclick",function(e){!isUrl(this.href)||(e.preventDefault(),window.postMessage(JSON.stringify({url:this.href})))})
  28. }();
  29. `;
  30. const autoHeightScript = `
  31. var styleElement = document.createElement('style');
  32. styleElement.innerHTML = '${style1
  33. .replace(/\'/g, "\\'")
  34. .replace(/\n/g, '\\n')}';
  35. document.head.appendChild(styleElement);
  36. document.body.style.background = 'cornflowerblue';
  37. `;
  38. const autoWidthHtml0 = `
  39. <html>
  40. <head>
  41. <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, user-scalable=no" />
  42. </head>
  43. <p class="localStyle" style="display: inline;background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));font-style: normal;zoom:1;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;">hey</p>
  44. </html>
  45. `;
  46. const autoWidthHtml1 = `
  47. <p style="display: inline;background-color: transparent !important;">easy</p>
  48. `;
  49. const autoWidthScript = `
  50. var styleElement = document.createElement('style');
  51. styleElement.innerHTML = '${style1
  52. .replace(/\'/g, "\\'")
  53. .replace(/\n/g, '\\n')}';
  54. document.head.appendChild(styleElement);
  55. `;
  56. export {
  57. autoHeightHtml0,
  58. autoHeightHtml1,
  59. style0,
  60. autoHeightScript,
  61. autoWidthHtml0,
  62. autoWidthHtml1,
  63. autoWidthScript,
  64. inlineBodyStyle,
  65. autoDetectLinkScript
  66. };