more bookmarklet improvements

This commit is contained in:
maxwell 2011-03-28 18:34:52 -07:00
parent f08b5dfafe
commit 9e5890288c
3 changed files with 14 additions and 7 deletions

View file

@ -26,7 +26,6 @@ class StatusMessagesController < ApplicationController
end end
def bookmarklet def bookmarklet
puts "foo"
@aspects = current_user.aspects @aspects = current_user.aspects
@aspect_ids = @aspects.map{|x| x.id} @aspect_ids = @aspects.map{|x| x.id}
render :layout => nil render :layout => nil

View file

@ -52,8 +52,8 @@
%br %br
%a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+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()}})()"} %a{:href => "javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+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! post to Diaspora v1

View file

@ -12,13 +12,21 @@
Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}"); Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}");
$(document).ready(function() $(document).ready(function()
{ {
Publisher.open();
$("#publisher").bind('ajax:success', function(){ $("#publisher").bind('ajax:success', function(){
$('h4').text("Your post was successful! Closing!"); $('h4').text("Your post was successful! Closing!");
Publisher.close();
window.setTimeout(window.close, 2000, true); window.setTimeout(window.close, 2000, true);
}); });
$("#publisher #status_message_fake_text").val("#{params[:url]} - #{params[:notes]}");
$("#publisher #status_message_text").val("#{params[:url]}"); var contents = "#{params[:title]} - #{params[:url]}";
Publisher.open(); 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 #new_status_message_pane