diff options
Diffstat (limited to 'src/assets')
-rw-r--r-- | src/assets/images/reuters.svg | 1 | ||||
-rw-r--r-- | src/assets/javascripts/general.js | 1 | ||||
-rw-r--r-- | src/assets/javascripts/quora.js | 2 | ||||
-rw-r--r-- | src/assets/javascripts/reuters.js | 106 |
4 files changed, 108 insertions, 2 deletions
diff --git a/src/assets/images/reuters.svg b/src/assets/images/reuters.svg new file mode 100644 index 00000000..aab389c3 --- /dev/null +++ b/src/assets/images/reuters.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 82.683 79.683" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round"><use xlink:href="#F" x="9.341" y="9.341"/><defs><linearGradient id="A" x1="89.71%" y1="27.52%" x2="3.20%" y2="73.53%"><stop offset="0%" stop-color="#ff9100"/><stop offset="5%" stop-color="#ff8d00"/><stop offset="25%" stop-color="#ff8300"/><stop offset="50%" stop-color="#ff8000"/><stop offset="75%" stop-color="#ff8300"/><stop offset="95%" stop-color="#ff8d00"/><stop offset="100%" stop-color="#ff9100"/></linearGradient><linearGradient id="B" x1="96.89%" y1="63.40%" x2="3.10%" y2="36.75%"><stop offset="0%" stop-color="#ff9100"/><stop offset="5%" stop-color="#ff8d00"/><stop offset="25%" stop-color="#ff8300"/><stop offset="50%" stop-color="#ff8000"/><stop offset="75%" stop-color="#ff8300"/><stop offset="95%" stop-color="#ff8d00"/><stop offset="100%" stop-color="#ff9100"/></linearGradient><linearGradient id="C" x1="84.77%" y1="84.03%" x2="15.82%" y2="15.95%"><stop offset="0%" stop-color="#ff9100"/><stop offset="5%" stop-color="#ff8d00"/><stop offset="25%" stop-color="#ff8300"/><stop offset="50%" stop-color="#ff8000"/><stop offset="75%" stop-color="#ff8300"/><stop offset="95%" stop-color="#ff8d00"/><stop offset="100%" stop-color="#ff9100"/></linearGradient><linearGradient id="D" x1="68.79%" y1="95.50%" x2="30.77%" y2="4.53%"><stop offset="0%" stop-color="#ff9100"/><stop offset="5%" stop-color="#ff8d00"/><stop offset="25%" stop-color="#ff8300"/><stop offset="50%" stop-color="#ff8000"/><stop offset="75%" stop-color="#ff8300"/><stop offset="95%" stop-color="#ff8d00"/><stop offset="100%" stop-color="#ff9100"/></linearGradient><linearGradient id="E" x1="49.85%" y1="100.03%" x2="49.85%" y2="0.03%"><stop offset="0%" stop-color="#ff9100"/><stop offset="5%" stop-color="#ff8d00"/><stop offset="25%" stop-color="#ff8300"/><stop offset="50%" stop-color="#ff8000"/><stop offset="75%" stop-color="#ff8300"/><stop offset="95%" stop-color="#ff8d00"/><stop offset="100%" stop-color="#ff9100"/></linearGradient></defs><symbol id="F" overflow="visible"><g stroke="none" fill-rule="nonzero"><path d="M28.509 21.28c.318.616.112 1.364-.504 1.868a1.25 1.25 0 0 1-1.7-.691c-.336-.598-.112-1.364.504-1.868a1.25 1.25 0 0 1 1.7.505zm-6.203 9.827a.75.75 0 0 0-.299 1.009c.196.361.648.495 1.009.299s.495-.648.299-1.009a.75.75 0 0 0-1.009-.299zm-.299-3.045a.86.86 0 0 0-.336 1.158c.224.43.747.56 1.177.374s.561-.747.374-1.177a.86.86 0 0 0-1.177-.336zm.785-2.914a.99.99 0 0 0-.411 1.326.98.98 0 0 0 1.345.374.99.99 0 0 0 .411-1.345.99.99 0 0 0-1.326-.392zm1.607-2.522a1.1 1.1 0 0 0-.448 1.513 1.07 1.07 0 0 0 1.495.448 1.11 1.11 0 0 0 .065-1.924 1.11 1.11 0 0 0-1.111-.037zm-1.214 11.303a.62.62 0 0 0-.243.841.62.62 0 0 0 .841.243c.292-.171.399-.541.243-.841-.079-.144-.212-.251-.37-.296s-.327-.026-.471.054zm14.273-10.275a.75.75 0 0 0 1.009.299.75.75 0 0 0 .299-1.009c-.196-.361-.648-.495-1.009-.299s-.495.648-.299 1.009zm-2.373-1.569c.224.411.747.56 1.158.336s.56-.747.374-1.158a.86.86 0 1 0-1.513.822zm-2.896-.785c.258.48.856.66 1.336.402s.66-.856.402-1.336-.856-.66-1.336-.402-.66.856-.402 1.336zm-3.027.112c.139.263.377.459.662.543a1.1 1.1 0 0 0 .851-.095 1.12 1.12 0 0 0 .448-1.513c-.289-.537-.958-.737-1.495-.448s-.737.958-.448 1.495zm10.313 4.521c.149.299.56.411.822.243.143-.075.249-.205.295-.36s.027-.322-.052-.462c-.075-.147-.207-.258-.365-.307s-.329-.033-.475.046c-.28.187-.411.56-.243.841zm-2.13 11.77c-.33-.609-1.091-.835-1.7-.504s-.835 1.091-.505 1.7c.336.617 1.121.822 1.868.504s.841-1.121.505-1.868zm-11.322-1.214c-.197-.349-.633-.481-.99-.299a.73.73 0 0 0-.295.986.73.73 0 0 0 .985.297.73.73 0 0 0 .3-.984zm2.504 1.588a.86.86 0 1 0-1.513.822c.224.411.747.561 1.158.374a.88.88 0 0 0 .355-1.177zm2.896.785c-.262-.486-.859-.654-1.345-.374a.99.99 0 0 0-.392 1.327c.262.486.859.654 1.345.411a.97.97 0 0 0 .411-1.345zm3.027-.112a1.12 1.12 0 0 0-1.513-.448c-.56.28-.747.934-.43 1.495.135.262.37.457.652.542s.586.051.843-.093c.56-.28.747-.934.448-1.495zm6.875-9.659c.176-.092.308-.249.368-.439s.041-.394-.05-.57c-.196-.361-.648-.495-1.009-.299s-.495.648-.299 1.009a.75.75 0 0 0 .99.299zm.131 2.989c.411-.224.56-.747.336-1.177a.86.86 0 0 0-1.158-.355.88.88 0 0 0-.355 1.177c.224.411.747.56 1.177.336zm-.747 2.896c.486-.262.654-.859.411-1.345a1 1 0 0 0-1.73-.046 1 1 0 0 0-.026.999.99.99 0 0 0 1.326.392zm-1.588 2.503c.56-.28.747-.971.448-1.495s-.971-.747-1.495-.448c-.537.289-.737.958-.448 1.495s.958.737 1.495.448z" fill="url(#A)"/><path d="M36.954 18.291c-.253.856-1.152 1.346-2.008 1.093s-1.346-1.152-1.093-2.008c.114-.61.565-1.102 1.163-1.268s1.238.023 1.651.487.524 1.122.288 1.697zm-15.506 3.811c-.423-.121-.864.121-.99.542-.069.402.174.793.566.907s.807-.083.966-.459c.131-.411-.112-.859-.56-.99zm2.802-3.083c-.521-.155-1.069.142-1.224.663s.142 1.069.663 1.224a.99.99 0 0 0 1.214-.673.99.99 0 0 0-.672-1.214zm3.587-2.167a1.27 1.27 0 0 0-1.551.841 1.25 1.25 0 0 0 .859 1.551 1.25 1.25 0 0 0 1.454-.87 1.25 1.25 0 0 0-.744-1.522zm3.979-.897a1.4 1.4 0 0 0-1.644 2.004 1.4 1.4 0 0 0 2.578-.266 1.4 1.4 0 0 0-.953-1.756zm-12.144 9.958a.6.6 0 0 0-.678.419.6.6 0 0 0 .341.72c.318.093.654-.093.747-.411a.6.6 0 0 0-.411-.747zM43.96 29.5c-.114.415.127.843.541.962s.845-.118.968-.53-.108-.846-.518-.974c-.423-.121-.864.121-.99.542zm-.934-3.979a.99.99 0 0 0 .673 1.233.98.98 0 1 0 .542-1.887.99.99 0 0 0-1.233.654zm-2.335-3.587a1.25 1.25 0 0 0 1.795 1.461 1.25 1.25 0 0 0-.245-2.302 1.25 1.25 0 0 0-1.551.841zm-3.064-2.802a1.4 1.4 0 1 0 2.689.789 1.4 1.4 0 0 0-.933-1.742 1.42 1.42 0 0 0-1.756.953zm5.829 14.386a.6.6 0 0 0 .392.747.6.6 0 0 0 .808-.713.6.6 0 0 0-.471-.427.6.6 0 0 0-.729.411zm-13.75 9.285c.236-.574.124-1.232-.288-1.697s-1.052-.653-1.65-.487-1.049.658-1.163 1.268c-.121.414-.074.859.133 1.237s.555.659.969.78c.859.243 1.756-.243 1.999-1.121zm-9.976-12.144c.12-.285.066-.613-.139-.844s-.524-.325-.821-.24-.52.332-.572.636c-.12.285-.066.613.139.844s.524.325.821.24.52-.332.572-.636zm.934 3.979a.98.98 0 0 0-1.887-.542.99.99 0 0 0 1.189 1.345.99.99 0 0 0 .698-.803zm2.167 3.587a1.27 1.27 0 0 0-.859-1.569 1.25 1.25 0 1 0-.694 2.405 1.25 1.25 0 0 0 1.553-.836zm3.064 2.802a1.42 1.42 0 0 0-.953-1.756 1.41 1.41 0 1 0-.785 2.709 1.42 1.42 0 0 0 1.756-.953zm16.198-2.989c.423.121.864-.121.99-.542.121-.423-.121-.864-.542-.99-.423-.121-.864.121-.99.542-.121.423.121.864.542.99zm-2.802 3.083c.521.155 1.069-.142 1.224-.663s-.142-1.069-.663-1.224a.99.99 0 0 0-1.233.673.99.99 0 0 0 .673 1.214zm-3.587 2.167a1.25 1.25 0 0 0 1.454-.87 1.25 1.25 0 0 0-2.035-1.289 1.25 1.25 0 0 0 .582 2.158zm-3.979.878a1.4 1.4 0 0 0 1.738-.953 1.4 1.4 0 1 0-2.69-.785 1.4 1.4 0 0 0 .953 1.737z" fill="url(#B)"/><path d="M45.025 19.093c-.792.822-2.1.849-2.925.061s-.859-2.096-.074-2.925 2.092-.868 2.925-.087c.839.79.88 2.11.093 2.952zm-20.682-4.727a1.03 1.03 0 0 0-.736-.284c-.274.007-.533.123-.721.322a1.03 1.03 0 0 0 .774 1.723 1.03 1.03 0 0 0 .683-1.76zm5.194-1.98a1.27 1.27 0 0 0-1.793.056 1.27 1.27 0 0 0 .056 1.793 1.27 1.27 0 0 0 1.793-.056 1.27 1.27 0 0 0-.056-1.794zm5.549-.374c-.646-.6-1.655-.566-2.261.075-.572.65-.527 1.636.103 2.23s1.617.583 2.233-.026c.294-.311.451-.727.437-1.155s-.198-.833-.512-1.124zm5.269 1.345a1.81 1.81 0 0 0-3.004.9 1.81 1.81 0 0 0 .519 1.735c.728.685 1.873.652 2.56-.075s.652-1.873-.075-2.56zm-20.401 4.484c-.149-.139-.346-.213-.549-.206s-.395.095-.534.243c-.23.188-.331.492-.258.78s.304.508.596.565.589-.059.765-.299c.139-.149.213-.346.206-.55s-.095-.395-.243-.534zm26.342 18.813a1.03 1.03 0 0 0-.284.736c.007.274.123.533.322.721a1.03 1.03 0 0 0 1.401-1.495 1.03 1.03 0 0 0-1.457.037zm1.308-5.287a1.27 1.27 0 0 0 .056 1.775 1.26 1.26 0 1 0 1.737-1.831 1.27 1.27 0 0 0-1.793.056zm-.374-5.549c-.417.413-.577 1.021-.415 1.585s.619.996 1.192 1.125 1.171-.065 1.559-.505c.572-.65.527-1.636-.103-2.23s-1.617-.583-2.233.026zm-1.943-5.156a1.81 1.81 0 0 0 1.362 3.065 1.81 1.81 0 0 0 1.179-3.14c-.747-.691-1.868-.635-2.541.075zM43.68 41.251c-.139.149-.213.346-.206.55s.095.395.243.534c.188.23.492.331.779.258s.508-.304.565-.596-.059-.589-.299-.765a.75.75 0 0 0-.55-.214c-.205.007-.398.098-.534.252zm-22.045 2.672a2.08 2.08 0 1 0-3.026-2.858 2.08 2.08 0 1 0 3.026 2.858zm-4.484-20.42a1.03 1.03 0 0 0-.485-1.766 1.03 1.03 0 0 0-1.01.365c-.374.411-.374 1.046.037 1.439a1.01 1.01 0 0 0 1.438-.037zm-1.308 5.287a1.27 1.27 0 0 0-.056-1.794 1.27 1.27 0 0 0-1.737 1.831 1.27 1.27 0 0 0 1.793-.056zm.411 5.567c.394-.421.533-1.019.366-1.57s-.616-.972-1.177-1.102-1.149.048-1.543.468c-.6.646-.566 1.655.075 2.261.654.617 1.868.561 2.242-.056zm1.943 5.156c.685-.728.652-1.873-.075-2.56a1.81 1.81 0 0 0-3.004.9 1.81 1.81 0 0 0 .519 1.734c.728.685 1.873.652 2.56-.075zm21.111 6.259c.26.286.659.401 1.031.299s.657-.405.735-.783a1.03 1.03 0 0 0-1.756-.91 1.03 1.03 0 0 0-.01 1.395zm-5.194 1.962c.504.486 1.308.448 1.794-.056.475-.511.445-1.309-.065-1.784s-1.31-.445-1.784.065a1.27 1.27 0 0 0 .056 1.775zm-5.567.411c.654.617 1.868.561 2.242-.056.418-.413.577-1.021.415-1.585s-.619-.996-1.192-1.125-1.171.065-1.559.505c-.6.646-.566 1.655.075 2.261zm-5.231-1.345c.721.677 1.855.642 2.533-.078s.645-1.854-.075-2.534-1.853-.648-2.534.071c-.328.346-.505.809-.49 1.286s.217.928.565 1.255z" fill="url(#C)"/><path d="M53.451 23.503c-1.274.547-2.752-.037-3.307-1.308-.543-1.268.043-2.737 1.31-3.284s2.737.035 3.287 1.3-.027 2.737-1.29 3.291zM35.796 7.511a1.39 1.39 0 1 0-2.728.542 1.39 1.39 0 1 0 2.728-.542zm5.978 1.308a1.68 1.68 0 0 0-2.849-.847 1.68 1.68 0 0 0-.402 1.688 1.68 1.68 0 0 0 2.849.847 1.68 1.68 0 0 0 .402-1.688zm5.455 2.429c-.346-1.104-1.521-1.719-2.625-1.373s-1.719 1.521-1.373 2.625 1.521 1.719 2.625 1.373 1.719-1.521 1.373-2.625zm4.372 3.737a2.31 2.31 0 0 0-4.334 1.607c.245.83.932 1.454 1.781 1.619s1.72-.158 2.257-.837.651-1.6.296-2.389zM23.876 9.062a1.01 1.01 0 0 0-1.864.031 1.01 1.01 0 0 0 1.341 1.295c.504-.224.747-.822.523-1.308zm25.184 33.33c-.618.444-.761 1.303-.322 1.923s1.298.769 1.921.332.776-1.294.343-1.919c-.211-.305-.536-.512-.901-.575s-.741.023-1.042.239zm2.765-5.605a1.68 1.68 0 0 0 .069 2.966 1.68 1.68 0 0 0 2.179-2.399 1.68 1.68 0 0 0-2.248-.567zm1.308-6.09c-1.004.568-1.359 1.842-.793 2.847s1.839 1.363 2.846.8 1.367-1.836.806-2.844a2.09 2.09 0 0 0-1.262-.997c-.537-.151-1.111-.081-1.596.193zm-.075-6.109c-1.144.568-1.612 1.956-1.046 3.101s1.956 1.614 3.101 1.046 1.614-1.956 1.046-3.101-1.956-1.612-3.101-1.046zM40.354 49.621a1.01 1.01 0 0 0-.221 1.756 1.01 1.01 0 0 0 1.025.093c.504-.224.747-.822.523-1.308a1.01 1.01 0 0 0-1.326-.523zm-28.136-8.482c1.271-.555 1.855-2.032 1.308-3.307s-2.033-1.86-3.307-1.308-1.86 2.032-1.308 3.307 2.033 1.855 3.307 1.308zm2.429-23.503c.404-.287.624-.768.577-1.261s-.353-.924-.803-1.13-.977-.156-1.381.131c-.624.444-.771 1.309-.327 1.934s1.309.771 1.934.327zm-2.765 5.605a1.68 1.68 0 0 0-.526-3.063 1.68 1.68 0 0 0-1.791 2.54 1.68 1.68 0 0 0 2.317.523zm-1.308 6.09a2.1 2.1 0 0 0 .044-3.636 2.1 2.1 0 0 0-2.903 2.833 2.1 2.1 0 0 0 2.858.803zm.224 6.09c.779-.344 1.307-1.088 1.374-1.938s-.338-1.667-1.055-2.128-1.628-.493-2.374-.081c-1.085.599-1.507 1.946-.957 3.057s1.878 1.591 3.012 1.091zm17.244 17.263c.146.667.757 1.127 1.439 1.084a1.4 1.4 0 0 0 1.084-1.644c-.15-.748-.877-1.233-1.625-1.084s-1.233.877-1.084 1.625zm-5.978-1.308a1.68 1.68 0 0 0 3.075.454 1.68 1.68 0 0 0-1.861-2.49 1.68 1.68 0 0 0-1.214 2.036zm-5.661-2.653c.352 1.099 1.528 1.706 2.628 1.355s1.708-1.525 1.359-2.626-1.522-1.711-2.623-1.364c-1.104.341-1.723 1.512-1.383 2.616zm-4.39-3.736a2.3 2.3 0 0 0 2.97 1.364c1.111-.5 1.645-1.775 1.221-2.918s-1.659-1.762-2.828-1.417c-1.195.446-1.804 1.774-1.364 2.971zm33.068 1.868c-.469.371-.549 1.053-.177 1.523s1.053.549 1.523.178.549-1.053.178-1.523-1.053-.549-1.523-.177zm-10.163 4.39c-.591.089-.999.639-.911 1.231s.638 1 1.23.913 1.001-.637.915-1.228c-.042-.285-.195-.542-.426-.714s-.522-.244-.807-.202zM29.481 7.511c-.089-.591-.639-.999-1.231-.911s-1 .638-.913 1.229.637 1.001 1.228.915c.285-.041.542-.195.714-.426s.244-.522.202-.807zm-10.911 4.11c-.177-.23-.439-.379-.727-.414s-.578.047-.805.227c-.467.371-.547 1.049-.178 1.518s1.047.552 1.517.185.556-1.044.192-1.517z" fill="url(#D)"/><path d="M60.587 33.292c-1.77-.01-3.198-1.45-3.195-3.22s1.437-3.204 3.207-3.207 3.209 1.425 3.22 3.195c0 .856-.341 1.676-.948 2.279s-1.429.94-2.284.935zM48.164 5.53c.133-.621-.074-1.266-.545-1.692s-1.133-.568-1.738-.374-1.059.697-1.192 1.318a1.78 1.78 0 0 0 1.364 2.111 1.78 1.78 0 0 0 2.111-1.364zm6.352 4.54a2.15 2.15 0 0 0-1.791-2.45 2.15 2.15 0 0 0-2.454 1.785 2.15 2.15 0 0 0 3.386 2.075 2.15 2.15 0 0 0 .86-1.41zm5.119 5.904zm3.176 6.819c.088-1.63-1.163-3.023-2.793-3.111s-3.023 1.163-3.111 2.793c-.057 1.055.453 2.059 1.338 2.636s2.01.637 2.952.159 1.557-1.422 1.613-2.477zM33.348 1.308A1.3 1.3 0 0 0 32.041 0a1.29 1.29 0 0 0-1.289 1.289 1.29 1.29 0 0 0 1.289 1.289 1.3 1.3 0 0 0 1.308-1.308zm12.704 51.975c-.621.133-1.123.588-1.318 1.192s-.052 1.267.374 1.737 1.071.679 1.692.545a1.78 1.78 0 0 0 1.364-2.111 1.78 1.78 0 0 0-2.111-1.364zm5.978-4.969c-1.176.186-1.979 1.29-1.794 2.466s1.29 1.979 2.466 1.794 1.979-1.29 1.793-2.466-1.29-1.979-2.466-1.793zm4.633-6.501a2.69 2.69 0 0 0-1.417 4.766 2.69 2.69 0 0 0 4.369-2.375 2.69 2.69 0 0 0-2.952-2.391zm2.989-7.23a2.97 2.97 0 0 0-2.802 3.101c.088 1.63 1.48 2.881 3.111 2.793s2.881-1.48 2.793-3.111a2.97 2.97 0 0 0-3.12-2.802zm-27.65 22.98a1.29 1.29 0 0 0-1.289 1.289 1.29 1.29 0 0 0 2.406.645 1.29 1.29 0 0 0-1.116-1.934zM3.232 33.274c1.77-.01 3.198-1.45 3.195-3.22S4.989 26.85 3.22 26.847.01 28.272 0 30.042c.01 1.778 1.454 3.213 3.232 3.213zM18.178 6.857c.461-.098.864-.376 1.12-.773s.343-.878.244-1.338c-.207-.957-1.151-1.566-2.109-1.36s-1.567 1.15-1.361 2.107 1.148 1.568 2.106 1.363zm-5.978 4.97a2.15 2.15 0 0 0 1.779-2.459 2.15 2.15 0 0 0-2.454-1.785 2.15 2.15 0 0 0-.931 3.86 2.15 2.15 0 0 0 1.606.383zm-4.633 6.502a2.69 2.69 0 0 0-.561-5.343c-.954.1-1.783.702-2.173 1.579s-.284 1.895.28 2.672 1.499 1.193 2.454 1.093zm-2.989 7.23a2.97 2.97 0 0 0 2.802-3.12 2.95 2.95 0 0 0-3.12-2.802c-1.63.088-2.881 1.48-2.793 3.111s1.48 2.881 3.111 2.793zm11.508 29.051c-.205.958.406 1.901 1.363 2.106s1.901-.404 2.107-1.361-.402-1.901-1.36-2.109c-.461-.1-.942-.012-1.339.244s-.674.659-.773 1.12zm-6.352-4.54a2.15 2.15 0 0 0 1.794 2.466 2.15 2.15 0 0 0 2.45-1.791 2.15 2.15 0 0 0-1.785-2.454 2.15 2.15 0 0 0-2.459 1.779zm-5.287-5.904c-.155 1.475.916 2.797 2.391 2.952s2.797-.916 2.952-2.391a2.69 2.69 0 0 0-2.391-2.952 2.67 2.67 0 0 0-2.952 2.391zm-3.363-6.763a2.95 2.95 0 0 0 2.802 3.101c1.055.057 2.059-.454 2.636-1.338s.637-2.01.159-2.952-1.422-1.557-2.477-1.614a2.97 2.97 0 0 0-3.12 2.802zm37.851 19.168c-.736.202-1.169.962-.968 1.698s.96 1.17 1.697.97 1.171-.959.971-1.696c-.092-.358-.324-.664-.643-.85a1.38 1.38 0 0 0-1.057-.14zm-14.199 0a1.39 1.39 0 0 0-.71 2.69 1.39 1.39 0 0 0 1.697-1.71 1.39 1.39 0 0 0-.987-.98zm15.88-53.899c.19-.737-.252-1.489-.989-1.682s-1.49.246-1.686.982.24 1.491.975 1.69a1.38 1.38 0 0 0 1.7-.99zm-14.871-.766a1.39 1.39 0 1 0-2.69.71 1.39 1.39 0 1 0 2.69-.71z" fill="url(#E)"/></g></symbol></svg> \ No newline at end of file diff --git a/src/assets/javascripts/general.js b/src/assets/javascripts/general.js index 7b643cfa..50d6ee33 100644 --- a/src/assets/javascripts/general.js +++ b/src/assets/javascripts/general.js @@ -64,6 +64,7 @@ const allPopupFrontends = [ "wikipedia", "medium", "quora", + "reuters", "peertube", "lbry", "sendTargets" diff --git a/src/assets/javascripts/quora.js b/src/assets/javascripts/quora.js index ecd305f0..bf87628b 100644 --- a/src/assets/javascripts/quora.js +++ b/src/assets/javascripts/quora.js @@ -65,8 +65,6 @@ function init() { init(); browser.storage.onChanged.addListener(init) -// https://www.quora.com/@keysikaspol/video/7061265241887345946 -// https://www.quora.com/@keysikaspol function redirect(url, type, initiator) { if (disableQuora) return; if (type != "main_frame") return; diff --git a/src/assets/javascripts/reuters.js b/src/assets/javascripts/reuters.js new file mode 100644 index 00000000..9afb67a9 --- /dev/null +++ b/src/assets/javascripts/reuters.js @@ -0,0 +1,106 @@ +window.browser = window.browser || window.chrome; + +import utils from './utils.js' + +const targets = [ + /^https?:\/{2}(www\.|)reuters\.com.*/ +]; + +let redirects = { + "neuters": { + "normal": [ + 'https://neuters.de', + ], + "tor": [] + } +} + +let + disableReuters, + reutersProtocol, + reutersRedirects, + neutersNormalRedirectsChecks, + neutersNormalCustomRedirects, + neutersTorRedirectsChecks, + neutersTorCustomRedirects; + +function init() { + return new Promise(async resolve => { + browser.storage.local.get( + [ + "disableReuters", + "reutersProtocol", + "reutersRedirects", + "neutersNormalRedirectsChecks", + "neutersNormalCustomRedirects", + "neutersTorRedirectsChecks", + "neutersTorCustomRedirects", + ], + r => { + disableReuters = r.disableReuters; + reutersProtocol = r.reutersProtocol; + reutersRedirects = r.reutersRedirects; + neutersNormalRedirectsChecks = r.neutersNormalRedirectsChecks; + neutersNormalCustomRedirects = r.neutersNormalCustomRedirects; + neutersTorRedirectsChecks = r.neutersTorRedirectsChecks; + neutersTorCustomRedirects = r.neutersTorCustomRedirects; + resolve(); + } + ) + }) +} + +init(); +browser.storage.onChanged.addListener(init) + +function redirect(url, type, initiator) { + if (disableReuters) return; + if (type != "main_frame") return; + const all = [ + ...reutersRedirects.neuters.normal, + ...neutersNormalCustomRedirects + ]; + if (initiator && (all.includes(initiator.origin) || targets.includes(initiator.host))) return; + if (!targets.some(rx => rx.test(url.href))) return; + + let instancesList; + if (reutersProtocol == 'normal') instancesList = [...neutersNormalRedirectsChecks, ...neutersNormalCustomRedirects]; + if (reutersProtocol == 'tor') instancesList = [...neutersTorRedirectsChecks, ...neutersTorCustomRedirects]; + if (instancesList.length === 0) return; + + const randomInstance = utils.getRandomInstance(instancesList); + // stolen from https://addons.mozilla.org/en-US/firefox/addon/reuters-redirect/ + if ( + url.pathname.startsWith('/article/') || + url.pathname.startsWith('/pf/') || + url.pathname.startsWith('/arc/') || + url.pathname.startsWith('/resizer/') + ) + return null; + else if (url.pathname.endsWith('/')) + return `${randomInstance}${url.pathname}`; + else + return `${randomInstance}${url.pathname}/`; +} + +function initDefaults() { + return new Promise(resolve => { + browser.storage.local.set({ + disableReuters: false, + reutersProtocol: "normal", + + reutersRedirects: redirects, + + neutersNormalRedirectsChecks: [...redirects.neuters.normal], + neutersNormalCustomRedirects: [], + + neutersTorRedirectsChecks: [...redirects.neuters.tor], + neutersTorCustomRedirects: [], + }, () => resolve()); + }); +} + +export default { + redirect, + initDefaults +}; |