Skip to content

Commit

Permalink
A small change in theme
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkrivtsov committed Jul 11, 2018
1 parent 0ad98b5 commit 8edcfa8
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 51 deletions.
47 changes: 0 additions & 47 deletions data/bottom_ad.js
Expand Up @@ -8,50 +8,3 @@
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>


$(function() {

var popupDiv = `
<div id="contact_popup">
<h1>Contact</h1>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.</p>
</div>
</div>`;

$('body').append(popupDiv);

animateSlider(this.hash);

function animateSlider(hash) {
if (!$('#container div.open').length) {
if (hash == '#about') {
openPopup(hash);
}
if (hash == '#contact') {
openPopup(hash);
}
} else {
if (hash == '#about') {
openAndClose(hash)
}
if (hash == '#contact') {
openAndClose(hash)
}
}
}

function openPopup(hash) {
$(hash + '_popup').slideToggle().addClass('open');
}

function openAndClose(hash) {
if ($(hash + '_popup').hasClass('open')) {
$($(hash + '_popup')).slideToggle().removeClass();
} else {
$('#container div.open').slideToggle().removeClass();
$(hash + '_popup').slideToggle().addClass('open');
}
}

});
127 changes: 127 additions & 0 deletions data/popup.js
@@ -0,0 +1,127 @@
<script>
$(document).ready(function() {

$(document).on('click', '#contact-close', function(event){
event.preventDefault();
setCookie('contact-cookie', '1', 30);
$('#contact_popup').slideToggle();
});

if ($(document).width() < 640) {
return; // Don't show this popup on small devices
}

var style = `
<style>
#contact_popup {
width:360px;
padding:20px;
background:#4185f2;
position:fixed;
left:50%;
margin-left: -180px;
bottom:0;
padding: 10px;
display:none;
-moz-border-radius-topleft:20px;
-moz-border-radius-topright:20px;
-webkit-border-top-left-radius:20px;
-webkit-border-top-right-radius:20px;
}
#contact_popup h1 {
margin-top: 0;
color:#fff;
font-size:20px;
}
#contact_popup p {
margin:0;
color:#fff;
}

.contact-btn {
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}

.btn-yes {
background-color: #4CAF50; /* Green */
}

.btn-no {
background-color: red;
}
</style>
`;

$('head').append(style);

var popupDiv = `
<div id="contact_popup">
<h1>Need Help with ZF3?</h1>

<p>You can contact Oleg (author of this book) to get paid consulting and/or ZF3 development assistance.</p>
<br>
<p>
<a class="contact-btn btn-yes" href="https://olegkrivtcov.wordpress.com/contact/">Contact now</a>&nbsp;&nbsp;<a id="contact-close" class="contact-btn btn-no" href="#">Not Now</a>
</P>
</div>
</div>`;

$('body').append(popupDiv);

var cookie = getCookie('contact-cookie');

if (cookie)
return; // Don't show this popup if user refused

if (Math.floor(Math.random() * 50) > 1) {
return; // Show this popup in 2% of views
}

$('#contact_popup').slideToggle();

function openPopup(hash) {
$(hash + '_popup').slideToggle().addClass('open');
}

function openAndClose(hash) {
if ($(hash + '_popup').hasClass('open')) {
$($(hash + '_popup')).slideToggle().removeClass();
} else {
$('#container div.open').slideToggle().removeClass();
$(hash + '_popup').slideToggle().addClass('open');
}
}

function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}

function getCookie(name) {
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;
}

function eraseCookie(name) {
document.cookie = name+'=; Max-Age=-99999999;';
}

});
</script>
4 changes: 2 additions & 2 deletions manuscript/en/preface.txt
Expand Up @@ -80,8 +80,8 @@ located under every page. Alternatively, you can contact the author through his

## About the Author

Oleg Krivtsov is a C++ and PHP developer. He has been developing sofware professionally
since 2005. Oleg is a Certified Zend Framework Architect ([proof](http://www.zend.com/en/yellow-pages/ZEND030290))
Oleg Krivtsov is a C++ and PHP developer. He has been developing software professionally
since 2005. Oleg is a Certified Zend Framework 2 Architect
and a Certified MySQL Developer. He likes contributing to open-source and writing programming articles for
popular web resources, like CodeProject. This writing passion has also inspired him to create this book
about Zend Framework 3. Oleg also loves skiing and watching Formula 1.
Expand Down
2 changes: 1 addition & 1 deletion manuscript/ru/preface.txt
Expand Up @@ -80,7 +80,7 @@ using-zf3-book-samples
## Об авторе

Олег Кривцов - разработчик программ на языках C++ и PHP. Он разрабатывает ПО профессионально
с 2005. Олег является сертифицированным Zend Framework Architect ([ссылка](http://www.zend.com/en/yellow-pages/ZEND030290))
с 2005. Олег является сертифицированным Zend Framework Architect
и сертифицированным MySQL Developer. Он любит вносить вклад в ПО с открытым исходным кодом и писать статьи для
популярных веб-ресурсов, таких как CodeProject. Олег также любит кататься на лыжах и смотреть Formula 1.

Expand Down
6 changes: 5 additions & 1 deletion openbook.json
Expand Up @@ -25,6 +25,7 @@
"es": "Español"
},
"incomplete_translations": ["es"],
"theme" : "default",
"google_analytics": {
"enabled": true,
"account_id": "UA-80824388-1"
Expand All @@ -42,5 +43,8 @@
"api_reference": {
"enabled": true,
"class_index_url": "https://olegkrivtsov.github.io/zf3-api-reference/html/class-index.json"
}
},
"chapter_js_scripts" : [
"data/popup.js"
]
}

0 comments on commit 8edcfa8

Please sign in to comment.