diff options
author | Habeas Codice <habeascodice@federated.social> | 2015-02-05 09:15:39 -0800 |
---|---|---|
committer | Habeas Codice <habeascodice@federated.social> | 2015-02-05 09:15:39 -0800 |
commit | 9ed23f9081b56369349d4e06c51e3856f950804e (patch) | |
tree | b3a1121ec41e04cce02cfa07fc958b95a3fd289b /view/js | |
parent | 88488fdfbb58aa04b450af1691aba7cea1bce8ab (diff) | |
parent | 646a874390be8f92736866118d7215e8cb80fb8a (diff) | |
download | volse-hubzilla-9ed23f9081b56369349d4e06c51e3856f950804e.tar.gz volse-hubzilla-9ed23f9081b56369349d4e06c51e3856f950804e.tar.bz2 volse-hubzilla-9ed23f9081b56369349d4e06c51e3856f950804e.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/mod_directory.js | 33 | ||||
-rw-r--r-- | view/js/ratings.js | 34 |
2 files changed, 67 insertions, 0 deletions
diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js index 74c8b414d..87e4f92b5 100644 --- a/view/js/mod_directory.js +++ b/view/js/mod_directory.js @@ -3,7 +3,40 @@ function dirdetails(hash) { $.get('dirprofile' + '?f=&hash=' + hash, function( data ) { $.colorbox({ maxWidth: "50%", maxHeight: "75%", html: data }); }); +} + + +var ratingVal = 0; +var ratingText = ''; +var currentHash = ''; + +function fetchRatings(hash) { + $.get('prate/'+hash, function(data) { + if(typeof(data.rating) !== 'undefined') { + ratingVal = data.rating; + ratingText = data.rating_text; + } + buildRatingForm(hash); + }); +} + + +function doRatings(hash) { + fetchRatings(hash); +} + +function buildRatingForm(hash) { + var html = '<form id="ratings_form" action="prate" method="post"><input type="hidden" name="target" value="'+hash+'" /><div class="rating-desc">'+aStr['rating_desc']+'</div><input id="dir-rating-range" class="directory-slider" type="text" value="'+ratingVal+'" name="rating" style="display: none;" /><div class="rating-text-label">'+aStr['rating_text']+'<input type="text" name="rating_text" class="directory-rating-text" value="'+ratingText+'" /><br /><input name="submit" class="directory-rating-submit" type="submit" value="'+aStr['submit']+'" onclick="postRatings(); return false;"></form><div class="clear"></div><script>$("#dir-rating-range").jRange({ from: -10, to: 10, step: 1, showLabels: false, showScale: true, scale : [ "-10","-5","0","5","10" ], onstatechange: function(v) { $("#dir-rating-range").val(v); } });</script>'; + + $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); + currentHash = hash; +} +function postRatings() { + $.post('prate',$('#ratings_form').serialize(),function(data) { + $.colorbox.remove(); + $('#edited-'+currentHash).show(); + },'json'); } $(document).ready(function() { diff --git a/view/js/ratings.js b/view/js/ratings.js new file mode 100644 index 000000000..3d48ecca5 --- /dev/null +++ b/view/js/ratings.js @@ -0,0 +1,34 @@ + +var ratingVal = 0; +var ratingText = ''; +var currentHash = ''; + +function fetchRatings(hash) { + $.get('prate/'+hash, function(data) { + if(typeof(data.rating) !== 'undefined') { + ratingVal = data.rating; + ratingText = data.rating_text; + } + buildRatingForm(hash); + }); +} + + +function doRatings(hash) { + fetchRatings(hash); +} + +function buildRatingForm(hash) { + var html = '<form id="ratings_form" action="prate" method="post"><input type="hidden" name="target" value="'+hash+'" /><div class="rating-desc">'+aStr['rating_desc']+'</div><input id="dir-rating-range" class="directory-slider" type="text" value="'+ratingVal+'" name="rating" style="display: none;" /><div class="rating-text-label">'+aStr['rating_text']+'<input type="text" name="rating_text" class="directory-rating-text" value="'+ratingText+'" /><br /><input name="submit" class="directory-rating-submit" type="submit" value="'+aStr['submit']+'" onclick="postRatings(); return false;"></form><div class="clear"></div><script>$("#dir-rating-range").jRange({ from: -10, to: 10, step: 1, showLabels: false, showScale: true, scale : [ "-10","-5","0","5","10" ], onstatechange: function(v) { $("#dir-rating-range").val(v); } });</script>'; + + $.colorbox({maxwidth: "50%", maxHeight: "50%", html: html, close: 'X' }); + currentHash = hash; +} + +function postRatings() { + $.post('prate',$('#ratings_form').serialize(),function(data) { + $.colorbox.remove(); + $('#edited-'+currentHash).show(); + },'json'); +} + |