diff options
author | Egil Moeller <egil.moller@freecode.no> | 2010-03-27 23:37:11 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2010-03-27 23:37:11 +0100 |
commit | 1d1583996664d21ff56c805d55179b745c8d466f (patch) | |
tree | ab662b3da98b3b03a4baa8a9dd1bd9a42f13ff98 | |
parent | 22e5679062bd999762a5495707914de245013f41 (diff) | |
download | etherpad-1d1583996664d21ff56c805d55179b745c8d466f.tar.gz etherpad-1d1583996664d21ff56c805d55179b745c8d466f.tar.xz etherpad-1d1583996664d21ff56c805d55179b745c8d466f.zip |
Added easy linking to searches
-rw-r--r-- | etherpad/src/plugins/twitterStyleTags/hooks.js | 2 | ||||
-rw-r--r-- | etherpad/src/plugins/twitterStyleTags/static/js/main.js | 40 |
2 files changed, 28 insertions, 14 deletions
diff --git a/etherpad/src/plugins/twitterStyleTags/hooks.js b/etherpad/src/plugins/twitterStyleTags/hooks.js index a5513f0..003bc32 100644 --- a/etherpad/src/plugins/twitterStyleTags/hooks.js +++ b/etherpad/src/plugins/twitterStyleTags/hooks.js @@ -10,7 +10,7 @@ function handlePath() { function padModelWriteToDB(args) { /* Update tags for the pad */ - var new_tags = args.pad.text().match(new RegExp("#[^,#!\\s][^,#!\\s]*", "g")); + var new_tags = args.pad.text().match(new RegExp("#[^,#=!\\s][^,#=!\\s]*", "g")); if (new_tags == null) new_tags = new Array(); for (i = 0; i < new_tags.length; i++) new_tags[i] = new_tags[i].substring(1); diff --git a/etherpad/src/plugins/twitterStyleTags/static/js/main.js b/etherpad/src/plugins/twitterStyleTags/static/js/main.js index 07da57e..a83e3e8 100644 --- a/etherpad/src/plugins/twitterStyleTags/static/js/main.js +++ b/etherpad/src/plugins/twitterStyleTags/static/js/main.js @@ -10,24 +10,38 @@ function aceInitInnerdocbodyHead(args) { } function aceGetFilterStack(args) { - return [args.linestylefilter.getRegexpFilter( - new RegExp("#[^,#!\\s][^,#!\\s]*", "g"), 'padtag')]; + return [ + args.linestylefilter.getRegexpFilter( + new RegExp("#[^,#=!\\s][^,#=!\\s]*", "g"), 'padtag'), + args.linestylefilter.getRegexpFilter( + new RegExp("=[^#=\\s][^#=\\s]*", "g"), 'padtagsearch') + ]; } function aceCreateDomLine(args) { - if (args.cls.indexOf('padtag') < 0) - return; + if (args.cls.indexOf('padtagsearch') >= 0) { + var href; + cls = args.cls.replace(/(^| )padtagsearch:(\S+)/g, function(x0, space, padtagsearch) { + href = '/ep/tag/?query=' + padtagsearch.substring(1); + return space + "padtagsearch padtagsearch_" + padtagsearch.substring(1); + }); - var href; - cls = args.cls.replace(/(^| )padtag:(\S+)/g, function(x0, space, padtag) { - href = '/ep/tag/?query=' + padtag.substring(1); - return space + "padtag padtag_" + padtag.substring(1); - }); + return [{ + cls: cls, + extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', + extraCloseTags: '</a>'}]; + } else if (args.cls.indexOf('padtag') >= 0) { + var href; + cls = args.cls.replace(/(^| )padtag:(\S+)/g, function(x0, space, padtag) { + href = '/ep/tag/?query=' + padtag.substring(1); + return space + "padtag padtag_" + padtag.substring(1); + }); - return [{ - cls: cls, - extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', - extraCloseTags: '</a>'}]; + return [{ + cls: cls, + extraOpenTags: '<a href="' + href.replace(/\"/g, '"') + '">', + extraCloseTags: '</a>'}]; + } } /* used on the client side only */ |