Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- var VOTE_DELAY = 500; // wait 1/2 second between individual votes
- var VOTE_YES_FOR = ['Julian Assange', 'Nigel Farage', 'Donald Trump', 'Marine Le Pen', 'Vladimir Putin'];
- function completePoll($scope, voteFor, completedCallback) {
- if($scope.isFinished()) {
- $scope.model.removeAnswers();
- completedCallback();
- return;
- }
- if($scope.States.state.name === 'cover')
- $scope.nextSlide();
- var slide = $scope.model.getCurrentSlide();
- var candiate = getCandiateForSlide(slide);
- var shouldVoteYes = _.some(voteFor, function(target) { return candiate.match(target) });
- var answerOption = slide.options[1 - shouldVoteYes | 0];
- console.log(candiate + ' -> ' + answerOption.value);
- $scope.vote(answerOption);
- $scope.model.nextSlide();
- $scope.$apply();
- setTimeout(function() { completePoll($scope, voteFor, completedCallback) }, VOTE_DELAY);
- }
- function getCandiateForSlide(slide) {
- var titleHtml = slide.title.value;
- return titleHtml.match(/">(.*?)</)[1].trim();
- }
- (function doRigging() {
- completePoll(angular.element(document.body).scope().$$childHead, VOTE_YES_FOR, doRigging);
- })();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement