Change #16

Както споменах в предния пост – “очаквайте още нови неща тея дни”. И ето, че се появи новия панел със бутони за споделяни

Задвижван само и изцяло от CSS3(пак за тези които не ползват браузъри, които да поддържат CSS3 – сори :)), елегантен, не-натрапващ се и в същото време лесно достъпен.

Първоначално смятах да го анимирам с jQuery(JavaScript библиотека), обаче в последствие реших да се възползвам(пък и да проверя) предимствата на CSS3. Оказа се че в общи линии анимациите стават изключително лесно което е голям плюс.

Ето кода който зарежда бутоните:


<div id="mw_custom_sharing"></div>
// функцията която зарежда самите бутони - във functions.php
function render_floating_social_buttons() {
$url = urlencode(curPageURL()); ?&gt; // тук се взима и енкоудва URL-то на сегащната страница
<div id="fb-root"></div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>

<div class="alignleft fb-share-btn"><a type="box_count" name="fb_share"></a></div>

&nbsp;

<div class="alignleft google-plusone"></div>

<script type="text/javascript">// <![CDATA[
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();

// ]]></script>
<a class="twitter-share-button" href="http://twitter.com/share" data-count="vertical">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<?php }

И съответно CSS-a :

 #mw_custom_sharing { width: 70px; height: 40px; overflow: hidden; padding: 15px 15px 15px 0; position: fixed; left: -75px; top: 130px; z-index: 100; -webkit-border-radius: 0 10px 10px 0; -moz-border-radius: 0 10px 10px 0; border-radius: 0 10px 10px 0; -webkit-transition: all 500ms ease-in-out; -moz-transition: all 500ms ease-in-out; -o-transition: all 500ms ease-in-out; transition: all 500ms ease-in-out; background: url(images/background.gif) repeat 0 0; } #mw_custom_sharing:hover { left: 0; height: auto; min-height: 330px !important; } /* това селектира всички елементи, които са директни наследници на #mw_custom_sharing, и не са script елемент И нямат id="fb-root" */ #mw_custom_sharing --> *:not(script):not(#fb-root) {
padding-bottom: 15px;
margin: 0 auto 15px auto !important;
text-align: center;
border-bottom: 1px solid #ccc;
width: 70px;
display: block;
}
/* за FB Share бутона трябва малко по-специфичен стил, за да се центрира */
#mw_custom_sharing .fb-share-btn .fb_share_count_wrapper { float: none; text-align: center; }

/* Това избира последните два директни наследника на #mw_custom_sharing, които не са script елемент и ...
Селектирам последните два, защото знам че почти винаги последния елемент е script */
body #mw_custom_sharing > :nth-last-child(-n+2):not(script):not(#fb-root) {
padding-bottom: 0 !important;
margin: 0 auto 0 auto !important;
border-bottom: none !important;
} 

Промени бяха направени по следните файлове:

  • header.php
  • functions.php
  • style.css

Линк към ревизията: Цък

A bit of refreshment

Aaaand after moving to the new domain I felt the need(and according to Google Analytics, the visits through the last week have increased a bit ) to make the next set of updates to the theme.

Generally, what visitors will notice are different slight design updates – rounded borders and slim shadows

What you can’t see on the first visit though is that the shadows will change their color according to the time of the day. Basically I’ve divided the day in 4 parts – night(24-6), morning(6-12), day(12-18) and evening(18-24) and each of the parts has a different color for the shadows.

PP: If you are from that percent of the people, that are still using an old browser(IE8 or older, Firefox under 3.5, and I’m not sure about the rest ) there is a pretty big chance, that you won’t see the rounded borders and shadows. If you really don’t see them – just update your browser – at least you will get much better browsing experience

Yellow-Orange Flower

New domain!

And finally I decided to buy another hosting plan + domain(really cheap actually) Unfortunately moonwatch.com is already taken, but I like this one as well

If you try to open a link from the old site, you will end-up in the same page, but on the new site – and this works with literally 18 lines of code :)))

I left the active theme on the old site stripped down to the minimum(index.php – empty, style.css – just the description of the theme, functions.php – only the redirecting function) in order to make the redirection as quick as possible.

The moving of the files themselves was quite quick, thanks to my favourite cPanel, which supports compressing/extracting of archive files. So instead of downloading and then uploading 1000+ files, I just downloaded 1, which I extracted here

Database export, some SQL queries after the import on the new server, and it was like nothing ever happened

So, here is the code for the redirect, and that will be all for this evening

function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
}
return $pageURL;
}

function redirect_to_new_domain() {
$requested = curPageURL();
wp_redirect(str_replace('moonwatch.kbsk-titanite.com', 'themoonwatch.com', $requested), 301);
exit;
}
add_action('init', 'redirect_to_new_domain', 1);

And now what?!

And now what, when you don’t know?
And now what, when you’re stuck,
When you wonder and feel helpless,
When you can’t change the past, and the future is blurred?

What you do, when you feel, but you can’t say,
What you do, when you’ve loved for too long,
But you just can’t let go, although there ain’t no chance?
Do you turn grey again?

You’re stuck in the trap of your own feelings…
You have to wait for the miracle, or sacrifice yourself,
if you want to get out – there’s no other solution.
In the end “too much love will kill you” if you’re too much yourself…