Skip to content

Commit 7531cc6

Browse files
author
Patrick van Kleef
committed
Merge branch 'release/2.13'
2 parents 3879e2f + 27fe1d9 commit 7531cc6

36 files changed

+3748
-458
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ To install this extension manually use the following steps:
7474
- Press the **Select** button
7575

7676
### Install the extension in Firefox
77-
Download the [Firefox OSDS .zip](https://github.com/openlink/structured-data-sniffer/releases/download/v2.12/OSDS_FF.zip)
77+
Download the [Firefox OSDS .zip](https://github.com/openlink/structured-data-sniffer/releases/download/v2.13/OSDS_FF.zip)
7878
file and extract the .xpi file.
7979

8080
To install this extension manually in Firefox v28+, use the following steps:

prepare_chrome.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SRC_DIR=$EXT_SRC
2020
DST_DIR=$EXT_DIRNAME
2121

2222
#copy common files
23-
for I_DIR in handlers.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
23+
for I_DIR in frame.js handlers.js converters.js ttl_gen.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
2424
cp -va $SRC_DIR/$I_DIR $DST_DIR/
2525
done
2626

prepare_edge.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
EXT_DIRNAME=./OSDS_Edge
3+
EXT_SRC=./src
4+
5+
rm -rf $EXT_DIRNAME
6+
7+
mkdir -pv $EXT_DIRNAME
8+
9+
10+
SRC_DIR=./
11+
DST_DIR=$EXT_DIRNAME
12+
13+
#copy info files
14+
for I_DIR in AUTHORS COPYING CREDITS; do
15+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
16+
done
17+
18+
19+
SRC_DIR=$EXT_SRC
20+
DST_DIR=$EXT_DIRNAME
21+
22+
#copy common files
23+
for I_DIR in frame.js handlers.js converters.js ttl_gen.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
24+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
25+
done
26+
27+
#copy Firefox related files
28+
for I_DIR in webrequest.js browser.js options.html panel.html page_panel.html; do
29+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
30+
done
31+
32+
cp -va $SRC_DIR/manifest.json.edge $DST_DIR/manifest.json
33+
cp -va $SRC_DIR/browser_edge.js $DST_DIR/browser.js
34+
35+
36+
for I_DIR in images lib; do
37+
mkdir -pv $DST_DIR/$I_DIR
38+
tar --exclude 'original' -cf - -C $SRC_DIR/$I_DIR .|tar -xf - -C $DST_DIR/$I_DIR
39+
done
40+

prepare_ff_webext.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
EXT_DIRNAME=./OSDS_FF_WebExt
3+
EXT_SRC=./src
4+
5+
rm -rf $EXT_DIRNAME
6+
7+
mkdir -pv $EXT_DIRNAME
8+
9+
10+
SRC_DIR=./
11+
DST_DIR=$EXT_DIRNAME
12+
13+
#copy info files
14+
for I_DIR in AUTHORS COPYING CREDITS; do
15+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
16+
done
17+
18+
19+
SRC_DIR=$EXT_SRC
20+
DST_DIR=$EXT_DIRNAME
21+
22+
#copy common files
23+
for I_DIR in frame.js handlers.js converters.js ttl_gen.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
24+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
25+
done
26+
27+
#copy Firefox related files
28+
for I_DIR in webrequest.js browser.js options.html panel.html page_panel.html; do
29+
cp -va $SRC_DIR/$I_DIR $DST_DIR/
30+
done
31+
32+
cp -va $SRC_DIR/manifest.json.ff $DST_DIR/manifest.json
33+
cp -va $SRC_DIR/browser_ff_WebExt.js $DST_DIR/browser.js
34+
35+
36+
for I_DIR in images lib; do
37+
mkdir -pv $DST_DIR/$I_DIR
38+
tar --exclude 'original' -cf - -C $SRC_DIR/$I_DIR .|tar -xf - -C $DST_DIR/$I_DIR
39+
done
40+

prepare_firefox.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SRC_DIR=$EXT_SRC
2020
DST_DIR=$EXT_DIRNAME/data
2121

2222
#copy common files
23-
for I_DIR in handlers.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
23+
for I_DIR in frame.js handlers.js converters.js ttl_gen.js html_gen.js options.js panel.js settings.js sniffer.css sniffer.js page_panel.js psniffer.css; do
2424
cp -va $SRC_DIR/$I_DIR $DST_DIR/
2525
done
2626

src/Firefox/main.js

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ var self = require("sdk/self");
2525
var tabs = require("sdk/tabs");
2626
var workers = require("sdk/content/worker");
2727
var ss = require("sdk/simple-storage");
28-
var sniff_panel = null;
28+
const {XMLHttpRequest} = require("sdk/net/xhr");
2929

30+
var sniff_panel = null;
3031

3132

3233
var button = ToggleButton({
@@ -100,8 +101,8 @@ function createSniffPanel()
100101
width: 680,
101102
height: 600,
102103
contentURL: "./panel_ff.html", // the same : self.data.url("panel.html"),
103-
contentScriptFile: ["./lib/jquery-1.11.3.min.js",
104-
"./lib/jquery-migrate-1.2.1.min.js",
104+
contentScriptFile: ["./lib/jquery-3.1.0.min.js",
105+
"./lib/jquery-migrate-3.0.0.min.js",
105106
"./lib/jquery-ui.min.js",
106107
"./lib/microdatajs/jquery.microdata.js",
107108
"./lib/microdatajs/jquery.microdata.json.js",
@@ -115,6 +116,8 @@ function createSniffPanel()
115116
"./browser_ff.js",
116117
"./settings.js",
117118
"./handlers.js",
119+
"./converters.js",
120+
"./ttl_gen.js",
118121
"./html_gen.js",
119122
"./panel.js"
120123
],
@@ -168,9 +171,9 @@ function createHandlerPanel(_uri, _type)
168171
var htab = tabs.open({
169172
url: "./page_panel_ff.html",
170173
onReady: function(tab) {
171-
tab.attach({
172-
contentScriptFile: ["./lib/jquery-1.11.3.min.js",
173-
"./lib/jquery-migrate-1.2.1.min.js",
174+
tab._handler_worker = tab.attach({
175+
contentScriptFile: ["./lib/jquery-3.1.0.min.js",
176+
"./lib/jquery-migrate-3.0.0.min.js",
174177
"./lib/jquery-ui.min.js",
175178
"./lib/microdatajs/jquery.microdata.js",
176179
"./lib/microdatajs/jquery.microdata.json.js",
@@ -185,23 +188,50 @@ function createHandlerPanel(_uri, _type)
185188
"./settings.js",
186189
"./page_panel.js",
187190
"./handlers.js",
191+
"./converters.js",
192+
"./ttl_gen.js",
188193
"./html_gen.js"
189194
],
190195
contentScriptOptions : { ver: self.version,
191196
url: _uri,
192197
type: _type }
193198
});
199+
200+
201+
tab._handler_worker.port.on("load_data", function(msg){
202+
if (msg.url) {
203+
204+
var xhr = new XMLHttpRequest();
205+
206+
xhr.onreadystatechange = function() {
207+
if (xhr.readyState == 4) {
208+
if (xhr.status===200)
209+
tab._handler_worker.port.emit("url_data", xhr.responseText);
210+
else
211+
{
212+
tab._handler_worker.port.emit("url_error", "error");
213+
}
214+
}
215+
}
216+
xhr.open ('GET', msg.url, true);
217+
xhr.setRequestHeader ('Accept', 'text/plain, */*');
218+
xhr.send (null);
219+
}
220+
});
221+
194222
}
195223
});
224+
225+
196226
}
197227

198228

199229

200230

201231
tabs.on('load', function(tab) {
202232
var worker = tab.attach({
203-
contentScriptFile: ["./lib/jquery-1.11.3.min.js",
204-
"./lib/jquery-migrate-1.2.1.min.js",
233+
contentScriptFile: ["./lib/jquery-3.1.0.min.js",
234+
"./lib/jquery-migrate-3.0.0.min.js",
205235
"./lib/jsonld.js",
206236
"./lib/microdatajs/jquery.microdata.js",
207237
"./lib/microdatajs/jquery.microdata.json.js",
@@ -245,8 +275,8 @@ function createPrefPanel()
245275
width: 570,
246276
height: 710,
247277
contentURL: "./options_ff.html",
248-
contentScriptFile: ["./lib/jquery-1.11.3.min.js",
249-
"./lib/jquery-migrate-1.2.1.min.js",
278+
contentScriptFile: ["./lib/jquery-3.1.0.min.js",
279+
"./lib/jquery-migrate-3.0.0.min.js",
250280
"./lib/jquery-ui.min.js",
251281
"./lib/jsuri.js",
252282
"./browser_ff.js",
@@ -285,7 +315,6 @@ function check_XHR(request)
285315
catch (exc)
286316
{
287317
}
288-
289318
return false;
290319
}
291320

src/Firefox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.12",
2+
"version": "2.13",
33
44
"name": "osds",
55
"title": "OpenLink Structured Data Sniffer",

src/browser.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,33 @@
1919
*/
2020

2121
var Browser = {
22-
// isFirefox:(!navigator.userAgent.match(/khtml/i) && !!navigator.userAgent.match(/Gecko/i)&& !!navigator.userAgent.match(/Firefox/i)),
23-
// isWebKit:!!navigator.userAgent.match(/AppleWebKit/),
2422
isChromeAPI: true,
25-
isFirefoxSDK: false
26-
}
23+
isFirefoxSDK: false,
24+
25+
isChromeWebExt: true,
26+
isFirefoxWebExt: false,
27+
isEdgeWebExt: false,
28+
29+
api: null,
30+
31+
openTab : function(uri, tab_index) {
32+
if (Browser.isEdgeWebExt) {
33+
if (tab_index!==undefined)
34+
Browser.api.tabs.create({url:uri, index:tab_index+1 });
35+
else
36+
Browser.api.tabs.getCurrent(
37+
function(tab) {
38+
if (tab!==undefined)
39+
Browser.api.tabs.create({url:uri, index:tab.index+1 });
40+
else
41+
Browser.api.tabs.create({url:uri});
42+
}
43+
)
44+
}else
45+
window.open(uri);
46+
}
47+
}
48+
49+
try {
50+
Browser.api = (Browser.isChromeAPI && Browser.isChromeWebExt) ? chrome : browser;
51+
} catch(e) {}

src/browser_edge.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* This file is part of the OpenLink Structured Data Sniffer
3+
*
4+
* Copyright (C) 2015-2016 OpenLink Software
5+
*
6+
* This project is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License as published by the
8+
* Free Software Foundation; only version 2 of the License, dated June 1991.
9+
*
10+
* This program is distributed in the hope that it will be useful, but
11+
* WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along
16+
* with this program; if not, write to the Free Software Foundation, Inc.,
17+
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*
19+
*/
20+
21+
var Browser = {
22+
isChromeAPI: true,
23+
isFirefoxSDK: false,
24+
25+
isChromeWebExt: false,
26+
isFirefoxWebExt: false,
27+
isEdgeWebExt: true,
28+
29+
api: null,
30+
31+
openTab : function(uri, tab_index) {
32+
if (Browser.isEdgeWebExt) {
33+
if (tab_index!==undefined)
34+
Browser.api.tabs.create({url:uri, index:tab_index+1 });
35+
else
36+
Browser.api.tabs.getCurrent(
37+
function(tab) {
38+
if (tab!==undefined)
39+
Browser.api.tabs.create({url:uri, index:tab.index+1 });
40+
else
41+
Browser.api.tabs.create({url:uri});
42+
}
43+
)
44+
}else
45+
window.open(uri);
46+
}
47+
}
48+
49+
try {
50+
Browser.api = (Browser.isChromeAPI && Browser.isChromeWebExt) ? chrome : browser;
51+
} catch(e) {}

src/browser_ff.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,33 @@
1919
*/
2020

2121
var Browser = {
22-
// isFirefox:(!navigator.userAgent.match(/khtml/i) && !!navigator.userAgent.match(/Gecko/i)&& !!navigator.userAgent.match(/Firefox/i)),
23-
// isWebKit:!!navigator.userAgent.match(/AppleWebKit/),
2422
isChromeAPI: false,
25-
isFirefoxSDK: true
26-
}
23+
isFirefoxSDK: true,
24+
25+
isChromeWebExt: false,
26+
isFirefoxWebExt: false,
27+
isEdgeWebExt: false,
28+
29+
api: null,
30+
31+
openTab : function(uri, tab_index) {
32+
if (Browser.isEdgeWebExt) {
33+
if (tab_index!==undefined)
34+
Browser.api.tabs.create({url:uri, index:tab_index+1 });
35+
else
36+
Browser.api.tabs.getCurrent(
37+
function(tab) {
38+
if (tab!==undefined)
39+
Browser.api.tabs.create({url:uri, index:tab.index+1 });
40+
else
41+
Browser.api.tabs.create({url:uri});
42+
}
43+
)
44+
}else
45+
window.open(uri);
46+
}
47+
}
48+
49+
try {
50+
Browser.api = (Browser.isChromeAPI && Browser.isChromeWebExt) ? chrome : browser;
51+
} catch(e) {}

0 commit comments

Comments
 (0)