Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ This release recommends using Ruby 2.2, while retaining Ruby 2.1 as an officiall Ruby 2.0 is no longer officially supported. ## Refactor * Improve bookmarklet [#5904](https://github.com/diaspora/diaspora/pull/5904) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) Loading app/assets/javascripts/app/views/bookmarklet_view.js +7 −3 Original line number Diff line number Diff line // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later app.views.Bookmarklet = Backbone.View.extend({ separator: ' - ', separator: "\n\n", initialize: function(opts) { // init a standalone publisher Loading @@ -25,8 +25,12 @@ app.views.Bookmarklet = Backbone.View.extend({ var p = this.param_contents; if( p.content ) return p.content; var contents = p.title + this.separator + p.url; if( p.notes ) contents += this.separator + p.notes; var contents = "### " + p.title + this.separator; if( p.notes ) { var notes = p.notes.toString().replace(/(?:\r\n|\r|\n)/g, "\n> "); contents += "> " + notes + this.separator; } contents += p.url; return contents; }, Loading app/assets/javascripts/bookmarklet.js 0 → 100644 +45 −0 Original line number Diff line number Diff line // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later var bookmarklet = function(url, width, height, opts) { // calculate popup dimensions & placement var dim = function() { var w = window, winTop = (w.screenTop ? w.screenTop : w.screenY), winLeft = (w.screenLeft ? w.screenLeft : w.screenX), top = (winTop + (w.innerHeight / 2) - (height / 2)), left = (winLeft + (w.innerWidth / 2) - (width / 2)); return "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left; }; // prepare url parameters var params = function() { var w = window, d = document, href = w.location.href, title = d.title, sel = w.getSelection ? w.getSelection() : d.getSelection ? d.getSelection() : d.selection.createRange().text, notes = sel.toString(); return "url=" + encodeURIComponent(href) + "&title=" + encodeURIComponent(title) + "¬es=" + encodeURIComponent(notes); }; // popup (or redirect) action var act = function() { var popupOpts = (opts || "location=yes,links=no,scrollbars=yes,toolbar=no"), jumpUrl = url + "?jump=yes"; (window.open(url + "?" + params(), "diaspora_bookmarklet", popupOpts + "," + dim()) || (window.location.href = jumpUrl + "&" + params())); }; if( /Firefox/.test(navigator.userAgent) ) { setTimeout(act, 0); } else { act(); } }; // @license-end app/helpers/application_helper.rb +4 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,10 @@ module ApplicationHelper timeago_tag(time, options.merge(:class => 'timeago', :title => time.iso8601, :force => true)) if time end def bookmarklet_url( height = 400, width = 620) "javascript:(function(){f='#{AppConfig.pod_uri.to_s}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=yes,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()" def bookmarklet_code(height=400, width=620) "javascript:" + BookmarkletRenderer.body + "bookmarklet('#{bookmarklet_url}', #{width}, #{height});" end def contacts_link Loading app/views/shared/_right_sections.html.haml +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ %i.entypo.bookmark = t('bookmarklet.heading') .content != t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), bookmarklet_url)) != t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), bookmarklet_code)) - if AppConfig.settings.paypal_donations.enable? || AppConfig.bitcoin_donation_address .section Loading Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ This release recommends using Ruby 2.2, while retaining Ruby 2.1 as an officiall Ruby 2.0 is no longer officially supported. ## Refactor * Improve bookmarklet [#5904](https://github.com/diaspora/diaspora/pull/5904) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) Loading
app/assets/javascripts/app/views/bookmarklet_view.js +7 −3 Original line number Diff line number Diff line // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later app.views.Bookmarklet = Backbone.View.extend({ separator: ' - ', separator: "\n\n", initialize: function(opts) { // init a standalone publisher Loading @@ -25,8 +25,12 @@ app.views.Bookmarklet = Backbone.View.extend({ var p = this.param_contents; if( p.content ) return p.content; var contents = p.title + this.separator + p.url; if( p.notes ) contents += this.separator + p.notes; var contents = "### " + p.title + this.separator; if( p.notes ) { var notes = p.notes.toString().replace(/(?:\r\n|\r|\n)/g, "\n> "); contents += "> " + notes + this.separator; } contents += p.url; return contents; }, Loading
app/assets/javascripts/bookmarklet.js 0 → 100644 +45 −0 Original line number Diff line number Diff line // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later var bookmarklet = function(url, width, height, opts) { // calculate popup dimensions & placement var dim = function() { var w = window, winTop = (w.screenTop ? w.screenTop : w.screenY), winLeft = (w.screenLeft ? w.screenLeft : w.screenX), top = (winTop + (w.innerHeight / 2) - (height / 2)), left = (winLeft + (w.innerWidth / 2) - (width / 2)); return "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left; }; // prepare url parameters var params = function() { var w = window, d = document, href = w.location.href, title = d.title, sel = w.getSelection ? w.getSelection() : d.getSelection ? d.getSelection() : d.selection.createRange().text, notes = sel.toString(); return "url=" + encodeURIComponent(href) + "&title=" + encodeURIComponent(title) + "¬es=" + encodeURIComponent(notes); }; // popup (or redirect) action var act = function() { var popupOpts = (opts || "location=yes,links=no,scrollbars=yes,toolbar=no"), jumpUrl = url + "?jump=yes"; (window.open(url + "?" + params(), "diaspora_bookmarklet", popupOpts + "," + dim()) || (window.location.href = jumpUrl + "&" + params())); }; if( /Firefox/.test(navigator.userAgent) ) { setTimeout(act, 0); } else { act(); } }; // @license-end
app/helpers/application_helper.rb +4 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,10 @@ module ApplicationHelper timeago_tag(time, options.merge(:class => 'timeago', :title => time.iso8601, :force => true)) if time end def bookmarklet_url( height = 400, width = 620) "javascript:(function(){f='#{AppConfig.pod_uri.to_s}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=yes,toolbar=no,width=#{width},height=#{height}'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()" def bookmarklet_code(height=400, width=620) "javascript:" + BookmarkletRenderer.body + "bookmarklet('#{bookmarklet_url}', #{width}, #{height});" end def contacts_link Loading
app/views/shared/_right_sections.html.haml +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ %i.entypo.bookmark = t('bookmarklet.heading') .content != t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), bookmarklet_url)) != t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), bookmarklet_code)) - if AppConfig.settings.paypal_donations.enable? || AppConfig.bitcoin_donation_address .section Loading