Commits

Maciej Wiśniowski committed fd07827

structure

Comments (0)

Files changed (3)

dj_banner/templates/dj_banner/banner.html

+<a id="banner_next_{{slug}}" href="{{next_url}}" style="display:none;"></a>
+<div id="display_time_{{slug}}" style="display:none;">{{display_time}}</div>
+{% if banner.link %}
+<a href="{% url dj_banner.views.redirect banner_id=banner.id %}" {% if banner.newwindow %} target="_blank" {% endif %}>
+{% endif %}
+{% if banner.html %}
+<script type="text/javascript">
+    jQuery(document).ready(function(){
+        base_url = "{% url dj_banner.views.redirect banner_id=banner.id %}";
+        jQuery("#clicker a").map(function(index, element){
+            var url = base_url + '?destination=' + jQuery(element).attr('href');
+            jQuery(element).attr('href', url);
+            {% if banner.newwindow %}
+            jQuery(element).attr('target', '_blank');
+            {% endif %}
+        });
+    });
+</script>
+<div id="clicker">
+{% autoescape off %}
+{{banner.cooked_html}}
+{% endautoescape %}
+</div>
+{% else %}
+<img style="border:none" width="{{set.size_x}}" height="{{set.size_y}}" src="{{banner.img.url}}"/>
+{% endif %}
+{% if banner.link %}
+</a>
+{% endif %}

dj_banner/templates/dj_banner/banner_tag.html

+{% if active %}
+<script type="text/javascript">
+    jQuery(window).load(function(){
+       load_banner_{{slug}}();
+    });
+
+    function load_next_{{slug}}(responseText, textStatus, XMLHttpRequest){
+        var tm = $("#display_time_{{slug}}").html();
+        var itm = parseInt(tm) * 1000;
+        if (isNaN(itm)) itm=20000;
+        setTimeout("load_banner_{{slug}}()", itm);
+    }
+
+    function load_banner_{{slug}}(){
+        var next = jQuery("#banner_next_{{slug}}");
+        if(next == null){
+            next_href = "{% url dj_banner.views.banner slug=slug %}"
+        }else{
+            var next_href = next.attr('href');
+            if(!next_href) {
+                next_href = "{% url dj_banner.views.banner slug=slug %}"
+            }
+        }
+        jQuery("#banner_slot_{{slug}}").load(next_href, load_next_{{slug}});
+    }
+</script>
+<div id="banner_slot_{{slug}}" class="banner_slot" style="width:{{width}}px;height:{{height}}px;">
+</div>
+{% endif %}
+{% if message %}
+<p>{{message}}</p>
+{% endif %}

dj_banner/templates/dj_banner/test.html

+{% load djbanner_tags %}
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <script type="text/javascript" src="http://wino.gorny.edu.pl/site_media/js/jquery.js"></script>
+    <style>
+        .banner_slot {
+            border:1px solid black;
+        }
+    </style>
+  </head>
+  <body>
+    <p>Baner</p>
+
+    {% banner_slot "a_set" 400 60 5 %}
+
+  </body>
+</html>