add portal agent "auto bookmark" in top right corner (#9109)

This commit is contained in:
Frédéric Péters 2015-11-25 14:15:53 +01:00
parent 478358d226
commit 31d43cec1b
3 changed files with 31 additions and 0 deletions

View File

@ -677,3 +677,14 @@ form .submit-button, form .cancel-button, #rub_service form .submit-button, #rub
#content h2 {
color: #d91a80;
}
a#publik-portal-agent {
position: absolute;
right: 0;
top: 0;
background: #D72A84;
padding: 1ex;
border-bottom-left-radius: 5px;
color: white;
font-weight: bold;
}

19
static/js/combo.back.js Normal file
View File

@ -0,0 +1,19 @@
$(function() {
/* add a link to portal agent if it was visited before */
function readCookie(name) { /* http://www.quirksmode.org/js/cookies.html */
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
var portal_agent_url = decodeURIComponent(readCookie('publik_portal_agent_url') || '');
var portal_agent_title = decodeURIComponent(readCookie('publik_portal_agent_title') || '');
if (portal_agent_url && portal_agent_title) {
$('<a id="publik-portal-agent" href="' + portal_agent_url + '">' +
portal_agent_title + '</a>').appendTo('body');
}
});

View File

@ -199,6 +199,7 @@
<script src="{{ site_base }}{{ STATIC_URL }}js/jquery.stellar.min.js" ></script>
<script src="{{ site_base }}{{ STATIC_URL }}js/bootstrap.min.js" ></script>
<script src="{{ site_base }}{{ STATIC_URL }}js/app.js" ></script>
<script src="{{ site_base }}{{ STATIC_URL }}js/combo.back.js" ></script>
<script>
gaProperty = '';