Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <img id="postImage" alt="Image" class="postimage">
- <script>
- (function () {
- let input = `{TEXT}`
- let id = Date.now()
- $('#postImage').attr('id', id).attr('src', 'https://i.imgur.com/gEGNc1v.gif')
- let corsProxy = 'http://cors-proxy.htmldriven.com/?url='
- //let input = `\n[url=https://postimg.cc/image/mk56q648t/][img]https://s14.postimg.cc/mk56q648t/free-steam-key_mini-ninjas.jpg[/img][/url]`
- input = input.replace('\n', '')
- let URL = input.split('][')[0].slice(5)
- let urlProxied = corsProxy + URL
- let pattern = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)(\.jpg|\.png|\.gif)/
- $.ajax({
- method: 'GET',
- url: urlProxied,
- }).then(function (res) {
- let resString = JSON.stringify(res)
- let matches = resString.match(pattern)[0]
- //$('#preview div').find('.content').append($('<img>').attr('src', matches).attr('alt', 'Image').addClass('postimage').attr('style', 'max-width: 815px; border: 3px solid transparent; border-radius: 6px; transition: border-color 0.1s ease-out; cursor: pointer;'))
- let output = `\n[img]${matches}[/img]`
- //let textAreaValue = $('#message').val()
- //$('#message').val(textAreaValue += output)
- //console.log(textAreaValue)
- $(`#${id}`).attr('src', matches).addClass('postimage')
- })
- }())
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement