Extract mobile bookmarklet JS to file

This commit is contained in:
Benjamin Neff 2016-09-19 02:19:38 +02:00 committed by Steffen van Bergerem
parent 459ebffa6e
commit fccabf9983
No known key found for this signature in database
GPG key ID: 315C9787D548DC6B
3 changed files with 23 additions and 15 deletions

View file

@ -0,0 +1,21 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
$(document).ready(function() {
function publisherContent(params) {
if (params.content) {
return params.content;
}
var content = params.title + " - " + params.url;
if (params.notes.length > 0) {
content += " - " + params.notes;
}
return content;
}
var content = publisherContent(gon.preloads.bookmarklet);
if (content.length > 0) {
$("#status_message_text").val(content);
}
});
// @license-end

View file

@ -4,18 +4,4 @@
= render :partial => 'publisher/publisher', :locals => { :aspect => :profile, :selected_aspects => @aspects, :aspect_ids => @aspect_ids }
:javascript
var contents = "#{escape_javascript params[:content]}";
if(!contents){
contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}";
var notes = "#{escape_javascript params[:notes]}";
if (notes.length > 0){
contents += " - " + notes;
}
}
$(document).ready(function() {
if (contents.length > 0) {
$("#status_message_text").val(contents);
}
});
= javascript_include_tag "mobile/bookmarklet"

View file

@ -75,6 +75,7 @@ module Diaspora
jquery-textchange.js
main.js
jsxc.js
mobile/bookmarklet.js
mobile/mobile.js
people.js
publisher.js