From 7c644c07e6f4ecc78f5a9faec3bbd88b6f9602e8 Mon Sep 17 00:00:00 2001 From: timb Date: Tue, 18 Aug 2015 19:01:03 -0700 Subject: try to load pngs from sally into editor properly --- js/clipboard.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/clipboard.js b/js/clipboard.js index a7dc8f6..2c32d12 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -271,7 +271,7 @@ var clipboard = (function () { function fetch_url(url, f, type){ type = type || 'arraybuffer' url = "/cgi-bin/proxy?" + url - // url = "http://198.199.72.134/cors/" + url + //url = "http://198.199.72.134/cors/" + url var xhr = new XMLHttpRequest() xhr.open('GET', url, true) xhr.responseType = type @@ -294,11 +294,20 @@ var clipboard = (function () { clipboard.import_colorcode(itxt.data, true) } } - + + function sally_url_convert(url){ + var png_regex = /https?:\/\/jollo\.org\/den\/sallies\/([0-9]+)\/([^.]+)\.png/ + var matches = url.match(png_regex) + if (!matches) return url + return 'https://jollo.org/den/sallies/' + matches[1] + '/raw-' + matches[2] + '?.txt' + // txt suffix to force asdf proxy + } + exports.load_from_location = function(){ var params = parse_url_search_params(window.location + '') if (!params.url) return var url = params.url + url = sally_url_convert(url) var type = get_filetype(url) switch (type){ case 'txt': -- cgit v1.2.3-70-g09d2