Skip to content

Commit

Permalink
Fixed it so that it copies it without the dialog
Browse files Browse the repository at this point in the history
Much better. This is a chrome extension so we might as well use
the document.exec command.
  • Loading branch information
patricksnape committed Dec 7, 2012
1 parent 9739b4b commit 4c71b13
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 510 deletions.
11 changes: 11 additions & 0 deletions background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>background</title>
<script src="jquery.min.js"></script>
<script src="background.js"></script>
</head>
<body>
<textarea id="clipboard"></textarea>
</body>
</html>
9 changes: 9 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function copy(str) {
var sandbox = $('#clipboard').val(str).select();
document.execCommand('copy');
sandbox.val('');
}

chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
copy(request);
});
Binary file removed images/ui-bg_flat_0_aaaaaa_40x100.png
Binary file not shown.
Binary file removed images/ui-bg_flat_75_ffffff_40x100.png
Binary file not shown.
Binary file removed images/ui-bg_glass_55_fbf9ee_1x400.png
Binary file not shown.
Binary file removed images/ui-bg_glass_65_ffffff_1x400.png
Binary file not shown.
Binary file removed images/ui-bg_glass_75_dadada_1x400.png
Binary file not shown.
Binary file removed images/ui-bg_glass_75_e6e6e6_1x400.png
Binary file not shown.
Binary file removed images/ui-bg_glass_95_fef1ec_1x400.png
Binary file not shown.
Binary file removed images/ui-bg_highlight-soft_75_cccccc_1x100.png
Binary file not shown.
Binary file removed images/ui-icons_222222_256x240.png
Binary file not shown.
Binary file removed images/ui-icons_2e83ff_256x240.png
Binary file not shown.
Binary file removed images/ui-icons_454545_256x240.png
Binary file not shown.
Binary file removed images/ui-icons_888888_256x240.png
Binary file not shown.
Binary file removed images/ui-icons_cd0a0a_256x240.png
Binary file not shown.
474 changes: 0 additions & 474 deletions jquery-ui.css

This file was deleted.

5 changes: 0 additions & 5 deletions jquery-ui.min.js

This file was deleted.

18 changes: 6 additions & 12 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
{
"name": "QuickStack",
"version": "0.1",
"version": "0.2",
"icons": { "48": "icon48.png",
"128": "icon128.png" },
"content_scripts": [ {
"all_frames": true,
"js": [ "jquery.min.js", "jquery-ui.min.js", "script.js" ],
"css": ["quickstack.css", "jquery-ui.css"],
"js": [ "jquery.min.js", "script.js" ],
"css": ["quickstack.css"],
"matches": [ "http://stackoverflow.com/*"]
} ],
"background": { "page": "background.html" },
"manifest_version": 2,
"description": "Quick expand StackOverflow posts",
"web_accessible_resources": [ "images/ui-bg_glass_75_dadada_1x400.png",
"images/ui-icons_454545_256x240.png",
"images/ui-bg_flat_75_ffffff_40x100.png",
"images/ui-icons_222222_256x240.png",
"images/ui-bg_highlight-soft_75_cccccc_1x100.png",
"images/ui-bg_flat_0_aaaaaa_40x100.png"
],
"description": "Quick expand StackOverflow posts",
"permissions": [
"tabs", "http://www.stackoverflow.com/", "http://api.stackexchange.com/*"
"clipboardRead", "clipboardWrite"
]
}
22 changes: 3 additions & 19 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,16 @@ $(document).ready(function() {
);

var dialogId = 'dialog-modal' + id + '-' + i;
var width = $(parent).width();
var height = $(parent).height();

$('body').append(
$('<div/>')
$('<textarea/>')
.attr('type', 'hidden')
.attr('id', dialogId)
.attr('title', 'Code Snippet')
.css('width', width)
.css('height', height)
.append(
$('<textarea/>')
.css('width', width)
.css('height', height)
.text(data)
.focus(function() { $(this).select() })
)
.text(data)
);

$(this).dblclick(function() {
$('#' + dialogId).dialog({
height: height,
width: width,
modal: true,
resizable: false
});
chrome.extension.sendMessage($('#' + dialogId).text());
});

i++;
Expand Down

0 comments on commit 4c71b13

Please sign in to comment.