Arxero

postImage final phpbb edit

May 9th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <img id="postImage" alt="Image" class="postimage">
  2.     <script>
  3.         (function () {
  4.             let input = `{TEXT}`
  5.             let id = Date.now()
  6.             $('#postImage').attr('id', id).hide()
  7.             let corsProxy = 'http://cors-proxy.htmldriven.com/?url='
  8.             input = input.replace('\n', '')
  9.             let URL = input.split('][')[0].slice(5)
  10.             let urlProxied = corsProxy + URL
  11.             let pattern = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)(\.jpg|\.png|\.gif)/
  12.  
  13.             $.ajax({
  14.                 method: 'GET',
  15.                 url: urlProxied,
  16.             }).then(function (res) {
  17.                 let resString = JSON.stringify(res)
  18.                 let matches = resString.match(pattern)[0]
  19.                 $(`#${id}`).attr('src', matches).addClass('postimage').show()
  20.             })
  21.         }())
  22.     </script>
Advertisement
Add Comment
Please, Sign In to add comment