# HG changeset patch # User veltr # Date 1371126695 -7200 # Node ID 47aa37d3e7504d85d92afa38e57e58a1307e6bba # Parent 0aa26796c69cbbabfe5ba7a59764426806242b02 Saying goodbye to the Twitter Search API :-( diff -r 0aa26796c69c -r 47aa37d3e750 client/css/renkan.css --- a/client/css/renkan.css Thu Jun 06 18:48:57 2013 +0200 +++ b/client/css/renkan.css Thu Jun 13 14:31:35 2013 +0200 @@ -611,30 +611,6 @@ color: #303080; } -.Rk-Twitter-Icon { - background-image: url(../img/search-logos.png); background-position: 0 -80px; -} - -.Rk-Twitter-Title-Icon { - height: 20px; background: url(../img/search-logos.png); background-position: 0 -80px; -} - -.Rk-Twitter-TwImage { - float: left; width: 48px; height: 48px; margin: 2px 0; -} - -.Rk-Twitter-TwTitle, .Rk-Twitter-TwDate, .Rk-Twitter-TwText, .Rk-Twitter-TwActions { - margin: 2px 0 2px 50px; -} - -p.Rk-Twitter-TwDate { - font-size: 11px; font-style: italic; -} - -p.Rk-Twitter-TwActions { - font-size: 11px; -} - .Rk-Bin-Main .searchmatch { background: #ffff80; } diff -r 0aa26796c69c -r 47aa37d3e750 client/js/i18n.js --- a/client/js/i18n.js Thu Jun 06 18:48:57 2013 +0200 +++ b/client/js/i18n.js Thu Jun 13 14:31:35 2013 +0200 @@ -29,7 +29,6 @@ "Click on the background canvas to add a node": "Cliquer sur le fond du graphe pour rajouter un nœud", "Click on a first node to start the edge": "Cliquer sur un premier nœud pour commencer le lien", "Click on a second node to complete the edge": "Cliquer sur un second nœud pour terminer le lien", - "Twitter": "Twitter", "Wikipedia": "Wikipédia", "Wikipedia in ": "Wikipédia en ", "French": "Français", diff -r 0aa26796c69c -r 47aa37d3e750 client/js/space-editor.js --- a/client/js/space-editor.js Thu Jun 06 18:48:57 2013 +0200 +++ b/client/js/space-editor.js Thu Jun 13 14:31:35 2013 +0200 @@ -174,7 +174,7 @@ ldtsection.hide(); } - if (data.type === "Wikipedia" || data.type === "Twitter" || (data.type === "Ldt" && data.ldt_type === "Results")) { + if (data.type === "Wikipedia" || (data.type === "Ldt" && data.ldt_type === "Results")) { data.search = kwfield.val(); kwdisplay.text(data.search); kwsection.show(); @@ -286,7 +286,7 @@ } - if (data.type === "Wikipedia" || data.type === "Twitter" || (data.type === "Ldt" && data.ldt_type === "Results")) { + if (data.type === "Wikipedia" || (data.type === "Ldt" && data.ldt_type === "Results")) { kwfield.val(data.search || ""); } @@ -326,14 +326,16 @@ $(".add-search-engine").click(function() { addSearchEngine({ - type:"Twitter" + type: "Wikipedia", + lang: "en" }, true); return false; }); $(".add-bin").click(function() { addBin({ - type:"Twitter", + type: "Wikipedia", + lang: "en", search: "" }, true); return false; diff -r 0aa26796c69c -r 47aa37d3e750 client/js/twitter-bin.js --- a/client/js/twitter-bin.js Thu Jun 06 18:48:57 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -Rkns.Twitter = { -}; - -Rkns.Twitter.Search = function(_renkan, _opts) { - this.renkan = _renkan; - this.opts = _opts; -}; - -Rkns.Twitter.Search.prototype.getBgClass = function() { - return "Rk-Twitter-Icon"; -}; - -Rkns.Twitter.Search.prototype.getSearchTitle = function() { - return this.renkan.translate("Twitter"); -}; - -Rkns.Twitter.Search.prototype.search = function(_q) { - this.renkan.tabs.push( - new Rkns.Twitter.Bin(this.renkan, { - search: _q - }) - ); -}; - -Rkns.Twitter.Bin = Rkns.Utils.inherit(Rkns._BaseBin); - -Rkns.Twitter.Bin.prototype.tweetTemplate = Rkns._.template( - '
  • ' - + '' - + '

    @<%=tweet.from_user%> (<%=tweet.from_user_name%>)

    ' - + '

    <%=date%>

    ' - + '

    <%=text%>

    ' - + '

    show original · ' - + 'reply · ' - + 'retweet · ' - + 'favorite

  • ' -); - -Rkns.Twitter.Bin.prototype._init = function(_renkan, _opts) { - this.renkan = _renkan; - this.search = _opts.search; - this.title_icon_$.addClass('Rk-Twitter-Title-Icon'); - this.title_$.html(this.search).addClass("Rk-Twitter-Title"); - this.refresh(); -}; - -Rkns.Twitter.Bin.prototype.render = function(searchstr) { - var _rgxp = new RegExp('('+(searchstr || this.search).replace(/(\W)/g,'\\$1')+')','gi'); - if (searchstr) { - var rxtest = new RegExp(searchstr.replace(/(\W)/g,'\\$1'),'i'); - } - function highlight(_text) { - return _text.replace(_rgxp, "$1"); - } - var _html = "", - _this = this, - count = 0; - Rkns._(this.data.results).each(function(_result) { - if (searchstr && !rxtest.test(_result.text)) { - return; - } - count++; - var _entities = [], - _users = _result.text.match(/@[\w_]+/gm), - _lastpos = 0; - if (_users) { - for (var _i = 0; _i < _users.length; _i++) { - var _m = _users[_i], - _start = _lastpos + _result.text.substr(_lastpos).search(_m), - _lastpos = _start + _m.length; - _entities.push({ - "text" : _m, - "start" : _start, - "end" : _lastpos, - "link" :'', - }); - } - } - var _hashes = _result.text.match(/([^&]|^)#[^\s,.!?=#@&;()]+/gm), - _lastpos = 0; - if (_hashes) { - for (var _i = 0; _i < _hashes.length; _i++) { - var _m = _hashes[_i], - _h = ( _m[0] == '#' ? _m : _m.substr(1) ), - _start = _lastpos + _result.text.substr(_lastpos).search(_h), - _lastpos = _start + _h.length; - _entities.push({ - "text" : _h, - "start" : _start, - "end" : _lastpos, - "link" :'', - }); - } - } - - var _urls = _result.text.match(/(www\.|https?:\/\/)[\w.\/_\-]+/gim), - _lastpos = 0; - if (_urls) { - for (var _i = 0; _i < _urls.length; _i++) { - var _m = _urls[_i], - _start = _lastpos + _result.text.substr(_lastpos).search(_m), - _lastpos = _start + _m.length; - _entities.push({ - "text" : _m, - "start" : _start, - "end" : _lastpos, - "link" :'', - }); - } - } - _entities = Rkns._(_entities).sortBy(function(a) { return a.start; }); - var _lastend = 0, - _text = Rkns._(_entities).map(function(_e) { - var _txt = highlight(_result.text.substring(_lastend, _e.start)) + _e.link + highlight(_e.text) + ''; - _lastend = _e.end; - return _txt; - }).join("") + highlight(_result.text.substring(_lastend)); - - _html += _this.tweetTemplate({ - tweet: _result, - date: new Date(_result.created_at.replace(/(\+|-)/,'UTC$1')).toLocaleString(), - text: _text - }); - }); - this.main_$.html(_html); - if (searchstr && count) { - this.count_$.text(count).show(); - } else { - this.count_$.hide(); - } - if (searchstr && !count) { - this.$.hide(); - } else { - this.$.show(); - } - this.renkan.resizeBins(); -}; - -Rkns.Twitter.Bin.prototype.refresh = function() { - var _this = this; - Rkns.$.ajax({ - url: "http://search.twitter.com/search.json", - dataType: "jsonp", - data: { - q: this.search, - rpp: 100 - }, - success: function(_data) { - _this.data = _data; - _this.render(); - } - }); -}; diff -r 0aa26796c69c -r 47aa37d3e750 client/render-test.html --- a/client/render-test.html Thu Jun 06 18:48:57 2013 +0200 +++ b/client/render-test.html Thu Jun 13 14:31:35 2013 +0200 @@ -19,7 +19,6 @@ - - @@ -44,7 +43,6 @@ @@ -81,7 +79,6 @@ diff -r 0aa26796c69c -r 47aa37d3e750 server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html --- a/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html Thu Jun 06 18:48:57 2013 +0200 +++ b/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html Thu Jun 13 14:31:35 2013 +0200 @@ -19,7 +19,6 @@ - @@ -51,10 +50,6 @@ search: "Digital Humanities" }, { - type: "Twitter", - search: "Digital Humanities" - }, - { title: "LDT Project", type: "Ldt", ldt_type: "Project", @@ -74,9 +69,6 @@ { type: "Wikipedia", lang: "ja" - }, - { - type: "Twitter" } ], property_files: [