aboutsummaryrefslogtreecommitdiff
path: root/views/default/tasks/js.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
commit228d3697bcd0218605be2e28131574cc85293a2e (patch)
tree6a59c627f6226bd2b3056b959acc9cc871eb1f8f /views/default/tasks/js.php
downloadelgg-228d3697bcd0218605be2e28131574cc85293a2e.tar.gz
elgg-228d3697bcd0218605be2e28131574cc85293a2e.tar.bz2
Squashed 'mod/tasks/' content from commit c9b1097
git-subtree-dir: mod/tasks git-subtree-split: c9b1097ce081d6893f9c939146208559c089dc15
Diffstat (limited to 'views/default/tasks/js.php')
-rw-r--r--views/default/tasks/js.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/views/default/tasks/js.php b/views/default/tasks/js.php
new file mode 100644
index 000000000..985e95e0a
--- /dev/null
+++ b/views/default/tasks/js.php
@@ -0,0 +1,35 @@
+<?php
+/*
+ *
+ */
+?>
+
+elgg.provide('elgg.ui.getSelection');
+
+elgg.ui.getSelection = function () {
+ if (window.getSelection) {
+ return window.getSelection().toString();
+ }
+ else if (document.getSelection) {
+ return document.getSelection();
+ }
+ else if (document.selection) {
+ // this is specifically for IE
+ return document.selection.createRange().text;
+ }
+}
+
+$(function() {
+ $('.elgg-menu-extras .elgg-menu-item-task a').click(function() {
+ var title = encodeURIComponent(elgg.ui.getSelection());
+ if (!title) {
+ title = encodeURIComponent($('h2.elgg-heading-main').text());
+ }
+ referer_guid = $('.elgg-form-comments-add input[name="entity_guid"]').val();
+ var href = $(this).attr('href') + "&title=" + title;
+ if (referer_guid) {
+ href += "&referer_guid=" + referer_guid;
+ }
+ $(this).attr('href', href);
+ });
+}); \ No newline at end of file