summaryrefslogtreecommitdiff
path: root/js/selection.js
diff options
context:
space:
mode:
authorPrashant S2016-09-06 16:28:26 +0530
committerGitHub2016-09-06 16:28:26 +0530
commitc95635c08a1fb160be7f15ffce35ea854560452f (patch)
tree96b3ad5ad81eab0111f638808ba15b61813635e0 /js/selection.js
parent271a34be9bb543a344b00e738cc49836e30bdc32 (diff)
parent41f8054e3baa8c910afd3b6b4fe6739c91b8c571 (diff)
downloadtextbook_companion_fixer-c95635c08a1fb160be7f15ffce35ea854560452f.tar.gz
textbook_companion_fixer-c95635c08a1fb160be7f15ffce35ea854560452f.tar.bz2
textbook_companion_fixer-c95635c08a1fb160be7f15ffce35ea854560452f.zip
Merge pull request #1 from prashantsinalkar/drupal_7.x
Fixed jquery, css code isses
Diffstat (limited to 'js/selection.js')
-rwxr-xr-xjs/selection.js49
1 files changed, 25 insertions, 24 deletions
diff --git a/js/selection.js b/js/selection.js
index 6834aca..639afe5 100755
--- a/js/selection.js
+++ b/js/selection.js
@@ -1,26 +1,27 @@
function getSelectionText(divID) {
- var selectedText = "";
- if (window.getSelection) {
- var sel = window.getSelection();
- var div = document.getElementById(divID);
-
- if (sel.rangeCount) {
- // Get the selected range
- var range = sel.getRangeAt(0);
- // Check that the selection is wholly contained within the div text
- // if (range.commonAncestorContainer == div.firstChild) {
- var selectedText = range.toString();
- // }
- }
- }
- return selectedText;
+ var selectedText = "";
+ if (window.getSelection) {
+ var sel = window.getSelection();
+ var div = document.getElementById(divID);
+ if (sel.rangeCount) {
+ // Get the selected range
+ var range = sel.getRangeAt(0);
+ // Check that the selection is wholly contained within the div text
+ // if (range.commonAncestorContainer == div.firstChild) {
+ var selectedText = range.toString();
+ // }
+ }
+ }
+ return selectedText;
}
-$(document).ready(function() {
- $(".fix-caption-code").mousedown(function() {
- $("#edit-caption").val("");
- });
- $(".fix-caption-code").mouseup(function() {
- quotedText = getSelectionText("#fix-caption-code");
- $("#edit-caption").val(quotedText);
- });
-});
+(function($) {
+ $(document).ready(function() {
+ $(".fix-caption-code").mousedown(function() {
+ $("#edit-caption").val("");
+ });
+ $(".fix-caption-code").mouseup(function() {
+ quotedText = getSelectionText("#fix-caption-code");
+ $("#edit-caption").val(quotedText);
+ });
+ });
+})(jQuery);