-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
56 lines (46 loc) · 1.47 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
*
* Copyright 2020 Sumanta Pakira
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*/
let path = location.pathname;
let classicPath;
let touchUIPath;
let previewPath;
let url;
if(path.startsWith("/editor.html/")){
classicPath = location.href.replace("editor.html","cf#");
url = path.substring(12);
}
if(path.startsWith("/cf")){
touchUIPath = location.href.replace("cf#","editor.html");
url = location.hash.substring(1);
}
if(path.endsWith("componentlist.html")){
var frompath = getQuerystring("fromPath");
url = frompath;
}
function getQuerystring(key) {
var query = window.location.search.substring(1);
var vars = query.split("=");
return vars[1];
}
if(url){
url = url.replace(/\.[^/.]+$/, "");
}
let hostname = location.protocol + "//" + location.hostname;
if(location.port){
hostname = hostname + ":" + location.port
}
chrome.runtime.sendMessage({classicUiPath: classicPath, touchUiPath: touchUIPath, url:url, hostname:hostname }, function(response) {
console.log(response.farewell);
});