Commit ec1bec70 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Merge branch 'add-to-bookmarks-button' into 'latest'

Add to bookmarks button

See merge request !60
parents 39b637d6 8a1744be
......@@ -13,6 +13,7 @@ banner: default # When you have custom images, change this setting's value to t
# Refer to assets/banners/default or assets/banners/frozen
logo: small # Change to "big" (without quotas) in case of having broad logo
new_menu: false
bookmarks_enabled: true
twitter_username: uni_lu
facebook_username: uni.lu
......
<script>
window.show_bookmark = function(el) {
var browser = detect_browser();
var os = detect_os();
var message = 'Please click "Add Bookmark" in the bookmarks bar to add the bookmark'
if (os == 'Mac OS' || os == 'undefined') {
message = 'In order to add the bookmark, please tap COMMAND + D on your keyboard, and click "Done!"';
} else if (os == 'Windows' || os == 'Linux') {
message = 'In order to add the bookmark, please tap Windows + D on your keyboard, and click "Done!"';
} else if (os == 'Android') {
message = 'Please tap the "Menu" icon (top right), then "Add bookmark" icon (at the top)'
}
alert(message);
}
function detect_browser() {
var isIE = /*@cc_on!@*/false || !!document.documentMode;
if (!!window.chrome) return 'chrome'
if (typeof InstallTrigger !== 'undefined') return 'firefox';
if (!!window.safari) return 'safari';
if (!!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) return 'opera';
if (!isIE && !!window.StyleMedia) return 'edge';
if (isIE) return 'ie';
return 'undefined';
}
function detect_os() {
var userAgent = window.navigator.userAgent;
var platform = window.navigator.platform;
var macs = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
var windowses = ['Win32', 'Win64', 'Windows', 'WinCE'];
var ioses = ['iPhone', 'iPad', 'iPod'];
if (macs.indexOf(platform) !== -1) {
return 'Mac OS';
} else if (ioses.indexOf(platform) !== -1) {
return 'iOS';
} else if (windowses.indexOf(platform) !== -1) {
return 'Windows';
} else if (/Android/.test(userAgent)) {
return 'Android';
} else if (!os && /Linux/.test(platform)) {
return 'Linux';
} else {
return 'undefined';
}
}
</script>
\ No newline at end of file
......@@ -9,12 +9,20 @@
{%- include header.html -%}
<main class="page-content" aria-label="Content">
<div class="wrapper">
{%- if page.show_print_button -%}
<div class="print-button">
<img src="{{ "assets/pdf.svg" | relative_url }}">
<a href="javascript:window.print()"><span>Print the page</span></a>
<div class="wrapper-menu-right">
{%- if site.bookmarks_enabled and page.show_bookmark_button -%}
<div>
<img src="{{ "assets/bookmark.svg" | relative_url }}">
<a href="#" onclick=show_bookmark()><span>Add to bookmarks</span></a>
</div>
{%- endif -%}
{%- if page.show_print_button -%}
<div>
<img src="{{ "assets/pdf.svg" | relative_url }}">
<a href="javascript:window.print()"><span>Print the page</span></a>
</div>
{%- endif -%}
</div>
{%- endif -%}
{{ content }}
</div>
</main>
......@@ -23,4 +31,7 @@
</div>
</body>
{%- include scripts.html -%}
{%- if site.bookmarks_enabled -%}
{%- include script_add_bookmark.html -%}
{%- endif -%}
</html>
......@@ -416,21 +416,27 @@ html {
display: block;
}
.print-button {
.wrapper-menu-right {
// Print button, add to bookmarks, etc.
float: right;
margin: 14px -2.5% 25px 10%;
padding-bottom: 5px;
color: #252525;
@media print {
display: none;
}
float: right;
color: #252525;
margin-right: -2.5%;
margin-top: 14px;
@include media-query($on-palm) {
display: none;
}
span {
padding-left: 5px;
div {
display: inline;
margin-right: 20px;
span {
padding-left: 2px;
}
}
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><rect fill="none" height="24" width="24"/><path d="M17,11v6.97l-5-2.14l-5,2.14V5h6V3H7C5.9,3,5,3.9,5,5v16l7-3l7,3V11H17z M21,7h-2v2h-2V7h-2V5h2V3h2v2h2V7z"/></svg>
\ No newline at end of file
---
layout: default
title: development
show_bookmark_button: true
order: 3
---
......@@ -45,4 +46,7 @@ Take a look in `_includes/social.html`.
## Banner link
If you want to override the link on the banner (by default it points to your index page), use the following in `_config.yml`:
`banner_link: https://wwwen.uni.lu/`
\ No newline at end of file
`banner_link: https://wwwen.uni.lu/`
## Add to bookmarks
If you want to see "Add to bookmarks" button, set: `bookmarks_enabled: true` in `_config.yml`, and set `show_bookmark_button: true` in the file header (or in the default settings in `_config.yml`).
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment