/[drupal]/contributions/modules/smackdown/smackdown.js
ViewVC logotype

Diff of /contributions/modules/smackdown/smackdown.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.2.2.10, Mon Aug 24 22:41:28 2009 UTC revision 1.1.2.2.2.11, Fri Oct 23 16:39:34 2009 UTC
# Line 1  Line 1 
1  // $Id: smackdown.js,v 1.1.2.2.2.9 2009/08/24 21:17:34 sirkitree Exp $  // $Id: smackdown.js,v 1.1.2.2.2.10 2009/08/24 22:41:28 sirkitree Exp $
2    
3  /**  /**
4   * Smackdown voting through AJAX   * Smackdown voting through AJAX
# Line 44  Line 44 
44     */     */
45    Drupal.smackdown.attachVote = function(context, selector) {    Drupal.smackdown.attachVote = function(context, selector) {
46      $(selector, context).each(function() {      $(selector, context).each(function() {
47        var $element = $(this), smackdownLocation = Drupal.settings.basePath + Drupal.theme('smackdownLocation');        var $element = $(this);
48        // Attach the on-click popup behavior to the element.        // Attach the on-click popup behavior to the element.
49        $element.click(function(e){        $element.click(function(e){
50          Drupal.theme('voting', $element);          Drupal.theme('voting', $element);
# Line 53  Line 53 
53          var params = {'cid':nid, 'sid':sid};          var params = {'cid':nid, 'sid':sid};
54          // post nid and context to smackdown/vote          // post nid and context to smackdown/vote
55          ajaxOptions = {          ajaxOptions = {
56            url: Drupal.settings.basePath + 'smackdown/vote',            url: Drupal.settings.basePath + 'smackdown/vote/' + Drupal.settings.smackdown.token,
57            dataType: 'json',            dataType: 'json',
58            data: params,            data: params,
59            success: function(json) {            success: function(json) {
60              // we put the location into a variable so that it can be changed by other modules              // we put the location into a variable so that it can be changed by other modules
61              location.href = smackdownLocation;              location.href = json.location
62            }            }
63          };          };
64          $.ajax(ajaxOptions);          $.ajax(ajaxOptions);
# Line 88  Line 88 
88      element.parent().css({'background-color':'#ffc'});      element.parent().css({'background-color':'#ffc'});
89      return element.parent().append(output);      return element.parent().append(output);
90    };    };
   
   Drupal.theme.prototype.smackdownLocation = function() {  
     return Drupal.settings.smackdown.location;  
   };  
   
91  })(jQuery);  })(jQuery);

Legend:
Removed from v.1.1.2.2.2.10  
changed lines
  Added in v.1.1.2.2.2.11

  ViewVC Help
Powered by ViewVC 1.1.2