Commit c30da934ea23ac31c7a07d8f2721a7883906117d
1 parent
2f37def6
Exists in
master
and in
1 other branch
Trying to have a js voting system.
Showing
4 changed files
with
92 additions
and
3 deletions
Show diff stats
src/web/static/css/style.css
src/web/templates/apprec.html
| ... | ... | @@ -2,6 +2,7 @@ $def with (recommends, pkg_summaries, form) |
| 2 | 2 | $var title: Feedback |
| 3 | 3 | $var mod = 'feedback'; |
| 4 | 4 | |
| 5 | + | |
| 5 | 6 | <script type="application/x-javascript"> |
| 6 | 7 | $$(document).ready(function() { |
| 7 | 8 | inithandlers(); |
| ... | ... | @@ -28,15 +29,14 @@ $for strategy, result in recommends.items(): |
| 28 | 29 | $for pkg in result: |
| 29 | 30 | $ count = count + 1 |
| 30 | 31 | <td style="text-align: center; border: 4px solid rgb(255, 255, 255); min-width: 160px;"> |
| 31 | - <p><a href="package/$pkg?height=350&width=650" class="thickbox" title="General information for package $pkg"><b>$pkg</b></a></p> | |
| 32 | + <p><a href="package/$pkg?height=350&width=650" class="thickbox" title="General information for package $pkg"><div class="smaller"><b>$pkg</b></div></a></p> | |
| 32 | 33 | <div class="screenshots cycle" style="height: 120px"> |
| 33 | 34 | <a class="image" href="http://screenshots.debian.net/screenshot/$pkg" title="Screenshot of package $pkg"> |
| 34 | - <img src="http://screenshots.debian.net/thumbnail/$pkg" alt="Screenshot"> | |
| 35 | + <img src="http://screenshots.debian.net/thumbnail/$pkg" alt="Screenshot" /> | |
| 35 | 36 | </a> |
| 36 | 37 | </div> |
| 37 | 38 | |
| 38 | 39 | <div class="imgcaption"> |
| 39 | - <a href="http://screenshots.debian.net/package/$pkg"> | |
| 40 | 40 | <p class="smaller">$pkg_summaries[pkg]</p> |
| 41 | 41 | </div> |
| 42 | 42 | </td> | ... | ... |
src/web/templates/layout.html
| ... | ... | @@ -11,6 +11,7 @@ $ url_base = "http://localhost:8080/" |
| 11 | 11 | <link href="/static/css/style.css" media="screen" rel="stylesheet" type="text/css" /> |
| 12 | 12 | <link href="/static/css/local.css" media="screen" rel="stylesheet" type="text/css" /> |
| 13 | 13 | <link href="/static/css/thickbox.css" media="screen" rel="stylesheet" type="text/css" /> |
| 14 | + <link href="/static/css/voting.css" media="screen" rel="stylesheet" type="text/css" /> | |
| 14 | 15 | |
| 15 | 16 | <script src="/static/js/jquery.js" type="text/javascript"></script> |
| 16 | 17 | <script src="/static/js/jquery.autocomplete.js" type="text/javascript"></script> |
| ... | ... | @@ -23,6 +24,74 @@ $ url_base = "http://localhost:8080/" |
| 23 | 24 | |
| 24 | 25 | <script type="text/javascript" src="/static/js/thickbox.js"></script> |
| 25 | 26 | |
| 27 | + <script type="text/javascript" src="/static/js/jquery.livequery.js"></script> | |
| 28 | + | |
| 29 | +<script type="text/javascript"> | |
| 30 | + $$(document).ready(function() { | |
| 31 | + $$('.like_button').mouseenter(function(e) { | |
| 32 | + $$('.tooltip').show(); | |
| 33 | + $$('.ilikethis').fadeIn(200); | |
| 34 | + }).mouseleave(function(e) { | |
| 35 | + $$('.ilikethis').fadeOut(200); | |
| 36 | + $$('.tooltip').hide(); | |
| 37 | + }); | |
| 38 | + $$('.dislike_button').mouseenter(function(e) { | |
| 39 | + $$('.tooltip2').show(); | |
| 40 | + $$('.idislikethis').fadeIn(200); | |
| 41 | + }).mouseleave(function(e) { | |
| 42 | + $$('.tooltip2').hide(); | |
| 43 | + $$('.idislikethis').fadeOut(200); | |
| 44 | + }); | |
| 45 | + | |
| 46 | + $$('.totalstatsbutton').livequery("mouseenter", function(e){ | |
| 47 | + $$('.greenBar').css("background-color","#AADA37"); | |
| 48 | + $$('.redbar').css("background-color","#CF362F"); | |
| 49 | + $$('.tooltip3').show(); | |
| 50 | + $$('.totalstats').fadeIn(200); | |
| 51 | + }).livequery("mouseleave", function(e){ | |
| 52 | + $$('.tooltip3').hide(); | |
| 53 | + $$('.greenBar').css("background-color","#DDDDDD"); | |
| 54 | + $$('.redbar').css("background-color","#DDDDDD"); | |
| 55 | + $$('.totalstats').fadeOut(200); | |
| 56 | + }); | |
| 57 | +}); | |
| 58 | + | |
| 59 | +$$(document).ready(function(){ | |
| 60 | + //$('#voting_result').fadeOut(); | |
| 61 | + $$('button').click(function(){ | |
| 62 | + var a = $$(this).attr("id"); | |
| 63 | + | |
| 64 | + $$.post("voting.php?value="+a, { | |
| 65 | + }, function(response){ | |
| 66 | + $$('#voting_result').fadeIn(); | |
| 67 | + $$('#voting_result').html($$(response).fadeIn('slow')); | |
| 68 | + // now update box bar | |
| 69 | + $$.post("update_box.php", { | |
| 70 | + }, function(update){ | |
| 71 | + $$('#update_count').html(unescape(update)); | |
| 72 | + }); | |
| 73 | + //////////// | |
| 74 | + // now update tooltip count | |
| 75 | + $$.post("update_tooltip.php", { | |
| 76 | + }, function(updates){ | |
| 77 | + $$('.tooltip3').html(unescape(updates)); | |
| 78 | + }); | |
| 79 | + //////////// | |
| 80 | + }); | |
| 81 | + }); | |
| 82 | +}); | |
| 83 | +function hideMesg(){ | |
| 84 | + | |
| 85 | + $$('.rating_message').fadeOut(); | |
| 86 | + $$.post("rating.php?show=1", { | |
| 87 | + }, function(response){ | |
| 88 | + $$('#inner').html(unescape(response)); | |
| 89 | + $$('#inner').fadeIn('slow'); | |
| 90 | + }); | |
| 91 | +} | |
| 92 | +</script> | |
| 93 | + | |
| 94 | + | |
| 26 | 95 | <!-- |
| 27 | 96 | <link rel="stylesheet" href="/static/cluetip/jquery.cluetip.css" type="text/css" /> |
| 28 | 97 | ... | ... |
src/web/templates/package.html
| ... | ... | @@ -45,4 +45,20 @@ $for facet, tags in pkg['tag'].items(): |
| 45 | 45 | |
| 46 | 46 | </tr></table> |
| 47 | 47 | </div> |
| 48 | + <div> | |
| 49 | + <button type="button" class="like_button" onclick=";return false;" id="like-$pkg" > | |
| 50 | + <img src="/static/images/pixel-vfl73.gif" alt=""> | |
| 51 | + <span>Like</span></button> | |
| 52 | + | |
| 53 | + <button type="button" class="dislike_button" onclick=";return false;" id="dislike-$pkg" > | |
| 54 | + <img src="/static/images/pixel-vfl73.gif" alt=""> | |
| 55 | + </button> | |
| 56 | + | |
| 57 | + <div id="update_count" style="float:left;"> | |
| 58 | + <?php include ('update_box.php')?> | |
| 59 | + </div> | |
| 60 | + <br clear="all" /> | |
| 61 | + <div id="voting_result"> | |
| 62 | + </div> | |
| 63 | + </div> | |
| 48 | 64 | ... | ... |