From 6cc0e38d0adce1b3276aad7ea3c618494a1a88ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20MORIN?= Date: Thu, 13 Nov 2014 16:12:52 +0100 Subject: [PATCH] avoid script execution if remote is a full HTML page TODO : need improvement if script in body part of the page --- src/readingTime.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/readingTime.js b/src/readingTime.js index 2779457..fe6733d 100644 --- a/src/readingTime.js +++ b/src/readingTime.js @@ -172,7 +172,13 @@ Licensed under the MIT license //get contents of remote file $.get(remotePath, function(data) { - + // avoid script execution if remote is a full html page + // TODO : need improvement if script in body part of the page + if (data.indexOf('')!==-1){ + data = data.split(''); + data = data[1]; + } + //set time using the remote target found in the remote file setTime($('
').html(data).find(remoteTarget).text());