Mother Jones
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” “http://www.w3.org/TR/REC-html40/loose.dtd”>
(function($)
$.quiz = function(quiz_data, options)
var container_elem;
var self;
var answer_tracking = [];
var correct_answers_element;
var quiz =
defaulting_behavior_on : true,
defaulting_flag : ‘!default’,
container : ‘quiz_container’,
possible_display_elements : this.name) return ”;
return jQuery(”
);
}
},
name : ‘topimage’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(
”
);
}
},
name : ‘topvideoembed’,
finder: function(container)
return container.find(‘.’ + this.name);
,
needs_aspect_ratio : true,
create_element : function(slide)
//check aspect ratio
if (!slide.topvideoembedaspectratio) return ”;
return jQuery(”
+ slidethis.name + ”
);
}
},
name : ‘title’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(‘
‘
+ slidethis.name + ”
);
}
},
name : ‘middleimage’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(
”
);
}
},
name : ‘middlevideoembed’,
needs_aspect_ratio : true,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
//check aspect ratio
if (!slide.middlevideoembedaspectratio) return ”;
return jQuery(”
+ slidethis.name + ”
);
}
},
name : ‘subhed’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(”
+ slidethis.name
+ ”
);
}
},
name : ‘text’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(”
+ slidethis.name
+ ”
);
}
},
name : ‘bottomimage’,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
if (!slidethis.name) return ”;
return jQuery(”
);
}
},
name : ‘bottomvideoembed’,
needs_aspect_ratio : true,
finder: function(container)
return container.find(‘.’ + this.name);
,
create_element : function(slide)
//check aspect ratio
if (!slide.bottomvideoembedaspectratio) return ”;
return jQuery(”
+ slidethis.name + ”
);
}
},
],
init : function(quiz_data, options)
self = this;
if (options)
for ( var option in options )
selfoption = optionsoption;
}
if (typeof(quiz_data) === ‘string’)
//is a google spreadsheet
self.make_quiz_from_google_spreadsheet(quiz_data);
return self;
self.calculate_aspectratios(quiz_data);
self.quiz_data = quiz_data;
self.create_cover();
for ( var i = 0; i < self.quiz_data.length; i++ )
self.append_question(i);
self.append_how_you_did_section();
return self;
},
append_how_you_did_section: function()
correct_answers_element = jQuery(‘0’);
var how_you_did_element = jQuery(”);
how_you_did_element.append(jQuery(‘You got ‘));
how_you_did_element.append(correct_answers_element);
how_you_did_element.append(jQuery(‘ correct answers out of ‘ + self.quiz_data.length + ‘ questions’));
cover.append(how_you_did_element);
,
make_quiz_from_google_spreadsheet: function(spreadsheet_id)
Tabletop.init(
key: spreadsheet_id,
proxy : ‘https://s3.amazonaws.com/mj-tabletop-proxy’,
callback: function(data)
var quiz_data = self.make_quiz_data_from_spreadsheet_data(data);
self.init(quiz_data, options);
,
simpleSheet: true
});
},
calculate_aspectratios: function(data)
for (var i = 0; i < data.length; i++)
var row = datai;
for (var k = 0; k < row.possible_answers.length; k++)
var answer = row.possible_answersk;
self.find_aspectratio_for_each_type_of_video_embed(answer);
self.find_aspectratio_for_each_type_of_video_embed(row.question);
}
},
find_aspectratio_for_each_type_of_video_embed : function(slide)
for (var i = 0; i < self.possible_display_elements.length; i++ )
var display = self.possible_display_elementsi;
if ( display.needs_aspect_ratio && slidedisplay.name )
slidedisplay.name + ‘aspectratio’
= self.find_aspectratio(slidedisplay.name);
}
},
find_aspectratio: function(videoembed)
var height = videoembed.match(/height=”d+”/);
if (!height ;
height = parseInt(height0.replace(/height=”/, ”).replace(/”/, ”));
var width = videoembed.match(/width=”d+”/);
if (!width || !width0)
console.log(‘Your video embed code needs a width.’);
return ”;
;
width = parseInt(width0.replace(/width=”/, ”).replace(/”/, ”));
return (height / width)*100;
},
pull_answer_value_from_spreadsheet : function(row, value, wrong_number, correct)
var correct = correct ? ‘right’ : ‘wrong’;
if (rowcorrect + wrong_number + value && rowcorrect + wrong_number + value !== self.defaulting_flag)
return (rowcorrect + wrong_number + value);
if ( (self.defaulting_behavior_on && rowcorrect + wrong_number + value !== self.defaulting_flag)
|| (!self.defaulting_behavior_on && rowcorrect + wrong_number + value === self.defaulting_flag)
)
return (rowcorrect + value && rowcorrect + value !== self.defaulting_flag
? rowcorrect + value
: (row’answer’ + value && row’answer’ + value !== self.defaulting_flag
? row’answer’ + value
: row’question’ + value
)
);
else
return ”;
},
get_possible_answers : function(row, is_correct)
var possible_answers = [];
var right_or_wrong = (is_correct ? ‘right’ : ‘wrong’);
if (rowright_or_wrong)
possible_answers.push(self.make_possible_answer(row, ”, is_correct));
for (var i = 0; i < 10; i++ )
if (rowright_or_wrong + i)
possible_answers.push(self.make_possible_answer(row, i, is_correct));
}
return possible_answers;
},
make_possible_answer: function(row, row_number, is_correct)
var right_or_wrong = (is_correct ? ‘right’ : ‘wrong’);
var answer =
answer: rowright_or_wrong + row_number,
correct: is_correct
;
for (var i = 0; i < self.possible_display_elements.length; i++ )
var display_element = self.possible_display_elementsi.name;
answerdisplay_element = self.pull_answer_value_from_spreadsheet(
row, display_element, row_number, is_correct
)
return answer;
},
make_quiz_data_from_spreadsheet_data: function(data)
var quiz = [];
for (var i = 0; i < data.length; i++)
var row = datai;
var possible_wrong_answers = self.get_possible_answers(row, false);
var possible_right_answers = self.get_possible_answers(row, true);
var right_answer_placement = [];
for (var j = 0; j < possible_right_answers.length; j++)
right_answer_placement.push(
Math.round(Math.random() * possible_wrong_answers.length)
);
// IMPORTANT TO SORT THIS. rather than check if a value is in, we only check the first
right_answer_placement.sort();
var possible_answers= [];
var right_answers_placed = 0;
for (var j = 0; j <= possible_wrong_answers.length; j++)
while (j === right_answer_placementright_answers_placed)
//push right answer
possible_answers.push(possible_right_answersright_answers_placed);
right_answers_placed++;
if (j === possible_wrong_answers.length)
continue;
possible_answers.push(possible_wrong_answersj);
}
var question =
question :
,
possible_answers : possible_answers,
rowNumber : row.rowNumber – 1
};
for (var j = 0; j < self.possible_display_elements.length; j++)
var display_value = self.possible_display_elementsj.name;
question.questiondisplay_value = row’question’ + display_value;
quiz.push(question);
}
return quiz;
},
append_question : function(question_index)
var question_data = self.quiz_dataquestion_index
var question_container = jQuery(‘<li class=”question_container row-fluid question_’
+ question_index
+ ‘”>’
);
question_container.append( self.build_question_element_from_row(question_data) );
question_container.append( self.build_possible_answer_elements_from_row(question_data, question_index) );
container_elem.append(question_container);
,
build_question_element_from_row: function(row)
var question_container = jQuery(”);
for (var i = 0; i < self.possible_display_elements.length; i++)
question_container.append(
self.possible_display_elementsi.create_element(row.question)
);
return question_container;
},
build_possible_answer_elements_from_row : function(question, question_index)
var answers_container = jQuery(”);
for (var i = 0; i < question.possible_answers.length; i++)
var answer_data = question.possible_answersi;
var possible_answer = jQuery(”
+ answer_data.answer
+ ”);
(function(question_index, answer_index, possible_answer)
possible_answer.bind(‘click’, function()
// was it the right answer?
var was_correct = self.quiz_dataquestion_index.possible_answersanswer_index.correct;
// Add correct classes to possible answers
answers_container.find(‘.selected’).removeClass(‘selected’);
$(this).addClass(‘selected’);
$(this).removeClass(‘possible_answer’);
answers_container
.find(‘.answer_’ + answer_index)
.addClass(
was_correct
? ‘correct_answer’
: ‘wrong_answer’
);
//track how many you got right the first time
if ( typeof(answer_trackingquestion_index) === ‘undefined’ )
answer_trackingquestion_index = was_correct;
self.update_correct_answers_element();
cover.find(‘.question_’ + question_index).addClass(
‘first_guess_’
+ ( was_correct
? ‘right’
: ‘wrong’
)
);
//show new slide
self.display_answer(self.quiz_dataquestion_index, question_index, self.quiz_dataquestion_index.possible_answersanswer_index);
// track that this was selected last
self.quiz_dataquestion_index.previously_selected = self.quiz_dataquestion_index.possible_answersanswer_index;
});
})(question_index, i, possible_answer);
answers_container.append(possible_answer);
}
return answers_container;
},
add_display_in_correct_place: function(container, place_in_display_elements, slide)
for ( var i = place_in_display_elements; i > 0; i– )
if (self.possible_display_elementsi – 1.finder(container).length )
self.possible_display_elementsi – 1.finder(container)
.after( self.possible_display_elementsplace_in_display_elements.create_element(slide) );
return;
}
container.prepend(
self.possible_display_elementsplace_in_display_elements.create_element(slide)
);
},
display_answer : function(question, question_index, answer)
var displayed_slide = question.previously_selected
? question.previously_selected
: question.question;
var slide = container_elem.find(‘.question_’ + question_index + ‘ .question’);
slide.addClass(‘revealed_answer’);
for (var i = 0; i < self.possible_display_elements.length; i++)
var display_value = self.possible_display_elementsi.name;
if ( answerdisplay_value != displayed_slidedisplay_value )
if ( !answerdisplay_value )
self.possible_display_elementsi.finder(slide).remove();
else if ( !displayed_slidedisplay_value )
self.add_display_in_correct_place(slide, i, answer);
else
self.possible_display_elementsi.finder(slide).before(
self.possible_display_elementsi.create_element( answer )
).remove();
}
}
},
create_cover : function()
cover = $(‘#’ + self.container);
container_elem = jQuery(”);
cover.append(container_elem);
container_elem.addClass(‘quiz_container’);
container_elem.css(‘padding’, ‘0px’);
,
update_correct_answers_element: function()
var right_answers = 0;
for (var i = 0; i < self.quiz_data.length; i++)
if (answer_trackingi)
right_answers++;
}
correct_answers_element.text(right_answers);
}
};
return quiz.init(quiz_data, options);
};
$.fn.quiz = function(quiz_data, options)
options = options ;
options.container = this.attr(‘id’);
this.quiz = $.quiz(quiz_data, options);
return this;
};
}(jQuery));
The Gray Lady has her standards, at least. For as long as anyone has kept track, the New York Times has enforced a strict policy of avoiding language it deems offensive while jumping through hoops to explain why. While cursing is permitted in excerpted works of fiction, in the paper’s news sections, f-bombs, s-words, racial slurs, and off-color terms such as “screw,” are strictly non grata. (The one exception: The 1998 publication of the NSFW Starr Report.)
No one—even Joe Biden—is exempt. In the hands of the Times copy desk, “cocksuckers” becomes “Offensive Adjective Inappropriate for Family Newspaper“; “fuck you money” is “forget you money“; and “slutbag” is euphemized as just one of “several vulgar and sexist terms” uttered by New York mayoral candidate Anthony Weiner’s spokeswoman. If—to borrow a trope that really ought to be banned—the Eskimos have 100 words for snow, the New York Times has at least 100 ways to say “fuck.” None of them use the word “fuck.”
Can you read between the lines to figure out which words the Times copy desk considered unfit to print in the quotes below? Give it your best fucking shot:
var quiz = jQuery(‘#quiz_container’).quiz(‘0AswaDV9q95oZdDlmanhkZDd0TVhVcGRSQjlqdzQwNUE’); //your published spreadsheet key or URL goes here
Like this quiz? Wanna build your own? Check out our open-source quiz builder here!
See the article here:
Quiz: All The Words That Aren’t Fit to Print in the New York Times