Benoit Sida 4 년 전
부모
커밋
1c8ef5e2ec
4개의 변경된 파일30개의 추가작업 그리고 2개의 파일을 삭제
  1. BIN
      PasteTab.crx
  2. 3
    0
      pack
  3. 22
    1
      src/scripts/background.js
  4. 5
    1
      src/scripts/oncopy.js

BIN
PasteTab.crx 파일 보기


+ 3
- 0
pack 파일 보기

7
     exit 1
7
     exit 1
8
 fi
8
 fi
9
 
9
 
10
+min="$1"_tmp
10
 dir=$1
11
 dir=$1
11
 key=$2
12
 key=$2
12
 name="PasteTab"
13
 name="PasteTab"
16
 zip="$name.zip"
17
 zip="$name.zip"
17
 trap 'rm -f "$pub" "$sig" "$zip"' EXIT
18
 trap 'rm -f "$pub" "$sig" "$zip"' EXIT
18
 
19
 
20
+# recursively minify js and css
21
+
19
 # zip up the crx dir
22
 # zip up the crx dir
20
 cwd=$(pwd -P)
23
 cwd=$(pwd -P)
21
 (cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
24
 (cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)

+ 22
- 1
src/scripts/background.js 파일 보기

1
-"use strict";function getContentFromClipboard(){var a=document.getElementById("sandbox");return a.value="",a.select(),document.execCommand("paste")&&(result=a.value),a.value="",chrome.browserAction.setBadgeText({text:result.length.toString()}),result}function onClickHandler(){var a=getContentFromClipboard(),b=window.open();b.document.write(a)}var result="";chrome.runtime.onMessage.addListener(function(a,b,c){"copy"==a.event&&getContentFromClipboard()}),chrome.browserAction.setBadgeText({text:""}),chrome.browserAction.onClicked.addListener(onClickHandler);
1
+var result = '';
2
+
3
+function getContentFromClipboard() {
4
+    var sandbox = document.getElementById('sandbox');
5
+    sandbox.value = '';
6
+    sandbox.select();
7
+    if (document.execCommand('paste'))
8
+	result = sandbox.value;
9
+    chrome.browserAction.setBadgeText({text: result.length.toString() });
10
+    return result;
11
+}
12
+
13
+function onClickHandler() {
14
+    window.open().document.write('<pre>' + getContentFromClipboard() + '</pre>');
15
+}
16
+
17
+chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
18
+    if (request.event == 'copy') getContentFromClipboard();
19
+});
20
+
21
+chrome.browserAction.setBadgeText({ text: '' });
22
+chrome.browserAction.onClicked.addListener(onClickHandler);

+ 5
- 1
src/scripts/oncopy.js 파일 보기

1
-"use strict";function onCopy(a){chrome.runtime.sendMessage({event:"copy"})}document.addEventListener("copy",onCopy,!0);
1
+function onCopy(e) {
2
+    chrome.runtime.sendMessage({event:"copy"});
3
+}
4
+
5
+document.addEventListener("copy", onCopy, true);