From 4ca79db36298e3d2b7228bf219857975c58bcdbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Sko=C5=99epa?= <jakub@skorepa.info>
Date: Mon, 4 Apr 2016 21:42:28 +0200
Subject: [PATCH] =?UTF-8?q?Jednoduch=C3=A9=20opravy=20clippyho?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 - Skryt na mobilu
 - position: absolute - opravuje jeho vyjetí z obrazovky na menších displayích
---
 articles/2016/nove-stranky.md | 103 +++++++++++++++++-----------------
 1 file changed, 53 insertions(+), 50 deletions(-)

diff --git a/articles/2016/nove-stranky.md b/articles/2016/nove-stranky.md
index 6e63243c..47968e13 100644
--- a/articles/2016/nove-stranky.md
+++ b/articles/2016/nove-stranky.md
@@ -41,58 +41,61 @@ pomocníka. K vytvoření pomocníka jsme použili knihovnu [ClippyJS](https://w
     $('head').append('<link rel="stylesheet" type="text/css" href="clippy.css">');
     clippy.load('Clippy', function(agent) {
         agent.show();
-        agent.speak("Vypadá to, že jste na našich nových stránkách poprvé. Potřebujete s něčím pomoci?");
-        var sleep = function(time) {
-            return function(agent) {
-                return new Promise(function(resolve, reject) {
-                    agent._addToQueue(function (complete) {
-                        window.setTimeout(function() {resolve(agent);complete();}, time);
+        if($("#o-nas").css("display") == "block") {
+            $(".clippy, .clippy-balloon").css("position","absolute");
+            agent.speak("Vypadá to, že jste na našich nových stránkách poprvé. Potřebujete s něčím pomoci?");
+            var sleep = function(time) {
+                return function(agent) {
+                    return new Promise(function(resolve, reject) {
+                        agent._addToQueue(function (complete) {
+                            window.setTimeout(function() {resolve(agent);complete();}, time);
+                        });
                     });
-                });
+                }
             }
+            Promise.resolve(agent)
+            .then(sleep(1000))
+            .then(function(agent) {
+                var chipPos = $(".chip").first().offset();
+                agent.moveTo(chipPos.left-120, chipPos.top-30);
+                agent.play("GestureLeft");
+                agent.speak("Pro zobrazení podobných článků můžete kliknout na štítek.");
+                return agent;
+            })
+            .then(sleep(1000))
+            .then(function(agent) {
+                var pos = $(".search-icon").first().offset();
+                agent.moveTo(pos.left-120, pos.top);
+                agent.play("GestureLeft");
+                agent.speak("Pro vyhledávání použijte ikonu lupy");
+                return agent;
+            })
+            .then(sleep(1000))
+            .then(function(agent) {
+                var pos = $("#o-nas").first().offset();
+                agent.moveTo(pos.left-120, pos.top);
+                agent.play("GestureLeft");
+                agent.speak("Pro navigaci stránkami použijte menu");
+                return agent;
+            })
+            .then(sleep(1000))
+            .then(function(agent) {
+                var pos = $(".brand-logo").first().offset();
+                var width = $(".brand-logo").first().width();
+                agent.moveTo(pos.left+width, pos.top);
+                agent.play("GestureRight");
+                agent.speak("Pro návrat na úvodní stránku můžete kliknout na logo OK1KVK");
+                return agent;
+            })
+            .then(sleep(1000))
+            .then(function(agent) {
+                var width = $(document).width();
+                var height = $(document).height();
+                agent.moveTo(width/2-62, height - 200);
+                agent.play("GestureDown");
+                agent.speak("Další užitečné odkazy naleznete v patičce stránky");
+                return agent;
+            });
         }
-        Promise.resolve(agent)
-        .then(sleep(1000))
-        .then(function(agent) {
-            var chipPos = $(".chip").first().offset();
-            agent.moveTo(chipPos.left-120, chipPos.top-30);
-            agent.play("GestureLeft");
-            agent.speak("Pro zobrazení podobných článků můžete kliknout na štítek.");
-            return agent;
-        })
-        .then(sleep(1000))
-        .then(function(agent) {
-            var pos = $(".search-icon").first().offset();
-            agent.moveTo(pos.left-120, pos.top);
-            agent.play("GestureLeft");
-            agent.speak("Pro vyhledávání použijte ikonu lupy");
-            return agent;
-        })
-        .then(sleep(1000))
-        .then(function(agent) {
-            var pos = $("#o-nas").first().offset();
-            agent.moveTo(pos.left-120, pos.top);
-            agent.play("GestureLeft");
-            agent.speak("Pro navigaci stránkami použijte menu");
-            return agent;
-        })
-        .then(sleep(1000))
-        .then(function(agent) {
-            var pos = $(".brand-logo").first().offset();
-            var width = $(".brand-logo").first().width();
-            agent.moveTo(pos.left+width, pos.top);
-            agent.play("GestureRight");
-            agent.speak("Pro návrat na úvodní stránku můžete kliknout na logo OK1KVK");
-            return agent;
-        })
-        .then(sleep(1000))
-        .then(function(agent) {
-            var width = $(document).width();
-            var height = $(document).height();
-            agent.moveTo(width/2-62, height - 200);
-            agent.play("GestureDown");
-            agent.speak("Další užitečné odkazy naleznete v patičce stránky");
-            return agent;
-        });
     });
 </script>
-- 
GitLab