Skip to content

Instantly share code, notes, and snippets.

@disem
Created July 8, 2015 09:03
Show Gist options
  • Save disem/4a9686be12f8e5d09be8 to your computer and use it in GitHub Desktop.
Save disem/4a9686be12f8e5d09be8 to your computer and use it in GitHub Desktop.
плюсануть в карму весь инбокс
var withProperty = [], els = document.getElementsByTagName('a'), i = 0;
for (i = 0; i < els.length; i++) {
if (els[i].hasAttribute('data-user_id')) {
ajaxObject = new XMLHttpRequest();
ajaxObject.open("POST", "/ajax/user/karma/vote/", true);
ajaxObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajaxObject.send('user=' + els[i].getAttribute('data-user_id') + '&karma_value=' + 2 + '&csrf_token=' + encodeURIComponent(globals.user.csrf_token));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment