Skip to content

Commit

Permalink
Some cleanup to the javascript file
Browse files Browse the repository at this point in the history
  • Loading branch information
sirkitree committed Oct 15, 2012
1 parent 8718fc2 commit ca8d69f
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions smackdown.js
Expand Up @@ -31,6 +31,7 @@
Drupal.smackdown.attachNotice(context, field_2 + ' field-type-node-reference');
}
}
}

This comment has been minimized.

Copy link
@sirkitree

sirkitree Oct 16, 2012

Author Owner

Missing a close bracket

};

/**
Expand All @@ -44,28 +45,28 @@
Drupal.smackdown.attachVote = function(context, selector) {
// a regex for selecting the correct selector
$('div[class^="'+selector+'"]').each(function() {
var $element = $(this).find('.field-items').children();
$element.attr('rel', nid).addClass('smackdown-processed');
$element.click(function(e) {
Drupal.theme('voting', $element);
var nid = $element.attr('rel'); //not compatible with clean URLs
var sid = Druapl.settings.smackdown.sid;
var parms = {'cid':nid, 'sid':sid};
ajaxOptions = {
url: Drupal.settings.basePath + '?q=smackdown/vote/' + Drupal.settings.smackdown.token,
dataType: 'json',
data: params,
success: function(json) {
//we put the location into a variable so that it can be changes by other modules.
if(json != null){
location.href = json.location;
}
}
};
$.ajax(ajaxOptions);
return false;
});
});

This comment has been minimized.

Copy link
@sirkitree

sirkitree Oct 16, 2012

Author Owner

Indentations were inconsistent

var $element = $(this).find('.field-items').children();
$element.attr('rel', nid).addClass('smackdown-processed');
$element.click(function(e) {
Drupal.theme('voting', $element);
var nid = $element.attr('rel'); //not compatible with clean URLs
var sid = Druapl.settings.smackdown.sid;
var parms = {'cid':nid, 'sid':sid};
ajaxOptions = {
url: Drupal.settings.basePath + '?q=smackdown/vote/' + Drupal.settings.smackdown.token,
dataType: 'json',
data: params,
success: function(json) {
//we put the location into a variable so that it can be changes by other modules.
if(json != null){
location.href = json.location;
}
}
};
$.ajax(ajaxOptions);
return false;
});
});
};

Drupal.smackdown.attachNotice = function(context, selector) {
Expand Down

0 comments on commit ca8d69f

Please sign in to comment.