aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/default
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-05-31 17:44:19 +0200
committerGitHub <noreply@github.com>2017-05-31 17:44:19 +0200
commit268309df5d8110f516940be06e9481d66f3fb5d6 (patch)
treea8e24aac4833aca98a276f4a289fb47597b079a2 /tpl/default
parent96b12e55f07e75aff6645d2acdab070e765df2f4 (diff)
parente2bcb9d915fdda15253dd730a6d172323a8e8564 (diff)
downloadShaarli-268309df5d8110f516940be06e9481d66f3fb5d6.tar.gz
Shaarli-268309df5d8110f516940be06e9481d66f3fb5d6.tar.zst
Shaarli-268309df5d8110f516940be06e9481d66f3fb5d6.zip
Merge pull request #884 from ArthurHoaro/hotfix/bookmarklet-url-limit
Selection is now limited to 2k characters using bookmarklets
Diffstat (limited to 'tpl/default')
-rw-r--r--tpl/default/tools.html14
1 files changed, 12 insertions, 2 deletions
diff --git a/tpl/default/tools.html b/tpl/default/tools.html
index 6951ad28..35173d17 100644
--- a/tpl/default/tools.html
+++ b/tpl/default/tools.html
@@ -72,10 +72,15 @@
72 function(){ 72 function(){
73 var%20url%20=%20location.href; 73 var%20url%20=%20location.href;
74 var%20title%20=%20document.title%20||%20url; 74 var%20title%20=%20document.title%20||%20url;
75 var%20desc=document.getSelection().toString();
76 if(desc.length>4000){
77 desc=desc.substr(0,4000)+'...';
78 alert('{function="str_replace(' ', '%20', t('The selected text is too long, it will be truncated.'))"}');
79 }
75 window.open( 80 window.open(
76 '{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+ 81 '{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+
77 '&amp;title='%20+%20encodeURIComponent(title)+ 82 '&amp;title='%20+%20encodeURIComponent(title)+
78 '&amp;description='%20+%20encodeURIComponent(document.getSelection())+ 83 '&amp;description='%20+%20encodeURIComponent(desc)+
79 '&amp;source=bookmarklet','_blank','menubar=no,height=800,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1' 84 '&amp;source=bookmarklet','_blank','menubar=no,height=800,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1'
80 ); 85 );
81 } 86 }
@@ -89,9 +94,14 @@
89 class="bookmarklet-link" 94 class="bookmarklet-link"
90 href="javascript:( 95 href="javascript:(
91 function(){ 96 function(){
97 var%20desc=document.getSelection().toString();
98 if(desc.length>4000){
99 desc=desc.substr(0,4000)+'...';
100 alert("{function="str_replace(' ', '%20', t('The selected text is too long, it will be truncated.'))"}");
101 }
92 window.open( 102 window.open(
93 '{$pageabsaddr}?private=1&amp;post='+ 103 '{$pageabsaddr}?private=1&amp;post='+
94 '&amp;description='%20+%20encodeURIComponent(document.getSelection())+ 104 '&amp;description='%20+%20encodeURIComponent(desc)+
95 '&amp;source=bookmarklet','_blank','menubar=no,height=800,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1' 105 '&amp;source=bookmarklet','_blank','menubar=no,height=800,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1'
96 ); 106 );
97 } 107 }