From 9e5890288c7aa9ea5c59bb85b2a67e8f9e5eb14a Mon Sep 17 00:00:00 2001 From: maxwell Date: Mon, 28 Mar 2011 18:34:52 -0700 Subject: [PATCH] more bookmarklet improvements --- app/controllers/status_messages_controller.rb | 1 - app/views/admins/user_search.html.haml | 4 ++-- app/views/status_messages/bookmarklet.html.haml | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 126c27514..8b0ad56c7 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -26,7 +26,6 @@ class StatusMessagesController < ApplicationController end def bookmarklet - puts "foo" @aspects = current_user.aspects @aspect_ids = @aspects.map{|x| x.id} render :layout => nil diff --git a/app/views/admins/user_search.html.haml b/app/views/admins/user_search.html.haml index d1c1cd2d6..f861870f5 100644 --- a/app/views/admins/user_search.html.haml +++ b/app/views/admins/user_search.html.haml @@ -52,8 +52,8 @@ %br -%a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}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=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"} - post to Diaspora! +%a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}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=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"} + post to Diaspora v1 diff --git a/app/views/status_messages/bookmarklet.html.haml b/app/views/status_messages/bookmarklet.html.haml index 67ca649e3..76080f422 100644 --- a/app/views/status_messages/bookmarklet.html.haml +++ b/app/views/status_messages/bookmarklet.html.haml @@ -12,14 +12,22 @@ Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}"); $(document).ready(function() { + Publisher.open(); $("#publisher").bind('ajax:success', function(){ $('h4').text("Your post was successful! Closing!"); + Publisher.close(); + window.setTimeout(window.close, 2000, true); }); - $("#publisher #status_message_fake_text").val("#{params[:url]} - #{params[:notes]}"); - $("#publisher #status_message_text").val("#{params[:url]}"); - Publisher.open(); - }); + + var contents = "#{params[:title]} - #{params[:url]}"; + if ("#{params[:notes]}".length > 0){ + contents = contents + " - #{params[:notes]}"; + } + + $("#publisher #status_message_fake_text").val(contents); + $("#publisher #status_message_text").val(contents); + }); #new_status_message_pane .span-15.last