[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Add button to bridges.html for hilighting all text bridge lines.
commit 505b9cd09f136c7f2d15322253462b32675eeaa3
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Thu Jan 15 21:39:29 2015 +0000
Add button to bridges.html for hilighting all text bridge lines.
This should hopefully make copying the bridge lines elsewhere less
error-prone for users.
---
lib/bridgedb/templates/assets/css/custom.css | 3 +-
lib/bridgedb/templates/bridges.html | 43 ++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/lib/bridgedb/templates/assets/css/custom.css b/lib/bridgedb/templates/assets/css/custom.css
index 3fd1065..0b2684e 100644
--- a/lib/bridgedb/templates/assets/css/custom.css
+++ b/lib/bridgedb/templates/assets/css/custom.css
@@ -119,4 +119,5 @@ div.bridge-lines {
border-radius: 6px 6px 6px 6px;
box-shadow: none;
-moz-box-sizing: border-box;
-}
\ No newline at end of file
+ cursor: copy;
+}
diff --git a/lib/bridgedb/templates/bridges.html b/lib/bridgedb/templates/bridges.html
index 7ac77dd..d3c10c1 100644
--- a/lib/bridgedb/templates/bridges.html
+++ b/lib/bridgedb/templates/bridges.html
@@ -6,6 +6,33 @@
</div>
</div>
+<script type="text/javascript">
+ // Takes one argument, `element`, which should be a string specifying the id
+ // of the element whose text should be selected.
+ function selectText(element) {
+ try {
+ var doc = document;
+ text = doc.getElementById(element);
+ var range;
+ var selection;
+
+ if (doc.body.createTextRange) {
+ range = document.body.createTextRange();
+ range.moveToElementText(text);
+ range.select();
+ } else if (window.getSelection) {
+ selection = window.getSelection();
+ range = document.createRange();
+ range.selectNodeContents(text);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
+ } catch (e) {
+ window.alert(e);
+ }
+ }
+</script>
+
<div class="container-narrow">
<div class="container-fluid">
@@ -31,6 +58,17 @@ ${answer.replace("\n", "<br />")}
</div>
</div>
+ <div class="container-fluid"
+ style="width: 100%; align: center; margin: auto;">
+ <div class="row" id="bridgesrow2" style="text-align: right; padding-right: 7%;">
+ <button class="btn btn-primary disabled" id="selectbtn"
+ onclick="selectText('bridgelines')"
+ title="Select all bridge lines">
+ <i class="icon icon-2x icon-paste"></i> ${_("""Select All""")}
+ </button>
+ </div>
+ </div>
+
<br />
<br />
@@ -92,4 +130,9 @@ ${_("""Uh oh, spaghettios!""")}
<br />
% endif
+<script type="text/javascript">
+ // Make the 'Select All' button clickable:
+ document.getElementById('selectbtn').className = "btn btn-primary";
+</script>
+
<hr />
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits