[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] index: Add notice about rebranding



commit ee7ed53ee2966a3237f20795ceccd8a69089fa09
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Tue Nov 14 11:41:34 2017 +0000

    index: Add notice about rebranding
---
 index.html             | 11 +++++++
 js/jquery.cookieBar.js | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)

diff --git a/index.html b/index.html
index 208a73b..7b88854 100644
--- a/index.html
+++ b/index.html
@@ -22,6 +22,7 @@
 
   <!-- jQuery -->
   <script src="https://metrics.torproject.org/js/jquery-3.2.1.min.js";></script>
+  <script src="js/jquery.cookieBar.js"></script>
 
   <!-- Bootstrap -->
   <link rel="stylesheet" href="css/bootstrap.min.css">
@@ -50,6 +51,13 @@
 
 <div id="wrapper" style="display:none;">
 
+  <div class="fixed-top cookie-message pt-1" style="background-color: #333; color: #eee;">
+  <div style="padding: 10px;">
+  Relay Search is the new name for Atlas. This rebranding is part of work aiming to merge this tool into the Tor Metrics website. No URLs have been changed at this time and we will implement redirects when the change does occur. Technical details may be found on the <a href="https://trac.torproject.org/projects/tor/ticket/23518";>Tor Project bug tracker</a>. Hiding this message will result in a cookie being stored on your computer to prevent this message being shown again in the future.
+      <a class="btn btn-sm btn-warning cbc" style="color:black;" href="#">Hide</a>
+  </div>
+  </div>
+
 <!-- secondary navigation -->
 <nav class="navbar navbar-default navbar-secondary">
   <div class="container-fluid">
@@ -145,6 +153,9 @@
   </div>
 </div> <!-- /container -->
 
+<script>
+$('.cookie-message').cookieBar({ closeButton: '.cbc' });
+</script>
 <script data-main="js/main" src="js/libs/require/require.js"></script>
 
   <div class="container-fluid" id="footer">
diff --git a/js/jquery.cookieBar.js b/js/jquery.cookieBar.js
new file mode 100644
index 0000000..2bbb2ce
--- /dev/null
+++ b/js/jquery.cookieBar.js
@@ -0,0 +1,86 @@
+/*!
+ * jQuery Cookiebar Plugin
+ * https://github.com/carlwoodhouse/jquery.cookieBar
+ *
+ * Copyright 2012-17, Carl Woodhouse. the cookie function is inspired by https://github.com/carhartl/jquery-cookie
+ * Disclaimer: if you still get fined for not complying with the eu cookielaw, it's not our fault.
+ * Licence: MIT
+ */
+
+(function ($) {
+	$.cookie = function (key, value, options) {
+		if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
+			options = $.extend({}, options);
+
+			if (value === null || value === undefined) {
+				options.expires = -1;
+			}
+
+			if (typeof options.expires === 'number') {
+				var days = options.expires, t = options.expires = new Date();
+				t.setDate(t.getDate() + days);
+			}
+
+			value = String(value);
+
+			return (document.cookie = [
+				encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
+				options.expires ? '; expires=' + options.expires.toUTCString() : '', // max-age is not supported by IE
+				options.path ? '; path=' + options.path : '',
+				options.domain ? '; domain=' + options.domain : '',
+				options.secure ? '; secure' : ''
+			].join(''));
+		}
+		options = value || {};
+		var decode = options.raw ? function (s) { return s; } : decodeURIComponent;
+
+		var pairs = document.cookie.split('; ');
+		for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
+			// IE
+			if (decode(pair[0]) === key) return decode(pair[1] || '');
+		}
+		return null;
+	};
+
+	$.fn.cookieBar = function (options) {
+		var settings = $.extend({
+			'closeButton': 'none',
+			'hideOnClose': true,
+			'secure': false,
+			'path': '/',
+			'domain': ''
+		}, options);
+
+		return this.each(function () {
+			var cookiebar = $(this);
+
+			// just in case they didnt hide it by default.
+			cookiebar.hide();
+
+			// if close button not defined. define it!
+			if (settings.closeButton == 'none') {
+				cookiebar.append('<a class="cookiebar-close">Continue</a>');
+				$.extend(settings, { 'closeButton': '.cookiebar-close' });
+			}
+
+			if ($.cookie('cookiebar') != 'hide') {
+				cookiebar.show();
+			}
+
+			cookiebar.find(settings.closeButton).click(function () {
+				if (settings.hideOnClose) {
+					cookiebar.hide();
+				}
+				$.cookie('cookiebar', 'hide', { path: settings.path, secure: settings.secure, domain: settings.domain, expires: 30 });
+				cookiebar.trigger('cookieBar-close');
+				return false;
+			});
+		});
+	};
+
+	// self injection init
+	$.cookieBar = function (options) {
+		$('body').prepend('<div class="ui-widget"><div style="display: none;" class="cookie-message ui-widget-header blue"><p>By using this website you allow us to place cookies on your computer. They are harmless and never personally identify you.</p></div></div>');
+		$('.cookie-message').cookieBar(options);
+	};
+})(jQuery);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits