説明なし

config.js 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. font-family: sans-serif;
  7. padding: 50px;
  8. box-sizing: border-box;
  9. }
  10. `;
  11. const style1 = `
  12. p {
  13. font-size: 12px !important;
  14. box-sizing: border-box;
  15. }
  16. `;
  17. const inlineBodyStyle = `
  18. @font-face {
  19. font-family: ae_AlArabiya;
  20. src:url("ae_AlArabiya.ttf");
  21. }
  22. body {
  23. font-family: ae_AlArabiya;
  24. display: inline-block;
  25. }
  26. `;
  27. // https://medium.com/@elhardoum/opening-external-links-in-browser-in-react-native-webview-18fe6a66312a
  28. const autoDetectLinkScript = `
  29. (function() {
  30. var links = document.querySelectorAll('a[href]');
  31. if (links) {
  32. for (var index = 0; index < links.length; index++) {
  33. links[index].addEventListener('click', function(event) {
  34. event.preventDefault();
  35. window.ReactNativeWebView.postMessage(JSON.stringify({ url: this.href }));
  36. });
  37. }
  38. }
  39. })();
  40. `;
  41. const autoHeightScript = `
  42. var styleElement = document.createElement('style');
  43. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  44. document.head.appendChild(styleElement);
  45. document.body.style.background = 'cornflowerblue';
  46. `;
  47. const autoWidthHtml0 = `
  48. <html>
  49. <head>
  50. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  51. </head>
  52. <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;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;padding-top:0;padding-bottom:0;">hey</p>
  53. </html>
  54. `;
  55. const autoWidthHtml1 = `
  56. <p style="display: inline;background-color: transparent !important;">easy</p>
  57. `;
  58. const autoWidthScript = `
  59. var styleElement = document.createElement('style');
  60. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  61. document.head.appendChild(styleElement);
  62. `;
  63. export {
  64. autoHeightHtml0,
  65. autoHeightHtml1,
  66. style0,
  67. autoHeightScript,
  68. autoWidthHtml0,
  69. autoWidthHtml1,
  70. autoWidthScript,
  71. inlineBodyStyle,
  72. autoDetectLinkScript
  73. };