You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
5.9 KiB
JavaScript

/* scroll and position fix the legend */
$(window).scroll(function(){
if ($(this).scrollTop() > 320) {
$('.legend').addClass('legendfixed');
} else {
$('.legend').removeClass('legendfixed');
}
});
$(document).ready(function() {
/* frequent words */
$('.chosen_words').click( function(){
var word = $(this).text();
alert(word);
});
$('.t_chosen_words').click( function(){
var word = $(this).text();
alert(word);
});
/* legend & pos tag highlights */
$(document).ready(function(){
$('.legendverb').mouseover(function(){ $('.legendverb').css('background-color', 'yellow'); });
$('.legendverb').mouseout(function(){ $('.legendverb').css('background-color', 'transparent'); });
$('.legendnoun').mouseover(function(){ $('.legendnoun').css('background-color', 'springgreen'); });
$('.legendnoun').mouseout(function(){ $('.legendnoun').css('background-color', 'transparent'); });
$('.legendadjective').mouseover(function(){ $('.legendadjective').css('background-color', 'blue'); });
$('.legendadjective').mouseout(function(){ $('.legendadjective').css('background-color', 'transparent'); });
$('.legendadverb').mouseover(function(){ $('.legendadverb').css('background-color', 'purple'); });
$('.legendadverb').mouseout(function(){ $('.legendadverb').css('background-color', 'transparent'); });
$('.legendpossesivepronoun').mouseover(function(){ $('.legendpossesivepronoun').css('background-color', 'red'); });
$('.legendpossesivepronoun').mouseout(function(){ $('.legendpossesivepronoun').css('background-color', 'transparent'); });
$('.legendpresentparticiple').mouseover(function(){ $('.legendpresentparticiple').css('background-color', 'brown'); });
$('.legendpresentparticiple').mouseout(function(){ $('.legendpresentparticiple').css('background-color', 'transparent'); });
$('.legendadjectivesuperlative').mouseover(function(){ $('.legendadjectivesuperlative').css('background-color', 'salmon'); });
$('.legendadjectivesuperlative').mouseout(function(){ $('.legendadjectivesuperlative').css('background-color', 'transparent'); });
$('.legendadverb-comparative-superative').mouseover(function(){ $('.legendadverb-comparative-superative').css('background-color', 'brown'); });
$('.legendadverb-comparative-superative').mouseout(function(){ $('.legendadverb-comparative-superative').css('background-color', 'transparent'); });
$('.legendpropernoun').mouseover(function(){ $('.legendpropernoun').css('background-color', 'pink'); });
$('.legendpropernoun').mouseout(function(){ $('.legendpropernoun').css('background-color', 'transparent'); });
$('.legendhide').mouseover(function(){ $('.legendhide').css('background-color', 'black'); });
$('.legendhide').mouseout(function(){ $('.legendhide').css('background-color', 'transparent'); });
// click to turn on background colors
$('.legendverb, .VB, .VBZ, .VBN, .VVD').click(function() {
$('.legendverb, .VB, .VBZ, .VBN, .VVD').toggleClass('verb'); //should stay in color on.
});
$('.legendadjective, .JJ').click(function() {
$('.legendadjective, .JJ').toggleClass('adjective');
});
$('.legendpossesivepronoun, .PRPS').click(function() {
$('.legendpossesivepronoun, .PRPS').toggleClass('possesivepronoun');
});
$('.legendpresentparticiple, .VBG').click(function() {
$('.legendpresentparticiple, .VBG').toggleClass('presentparticiple');
});
$('.legendadjectivesuperlative, .JJS').click(function() {
$('.legendadjectivesuperlative, .JJS').toggleClass('adjectivesuperlative');
});
$('.legendnoun, .NN, .NNS').click(
function() {
$('.legendnoun, .NN, .NNS').toggleClass('noun');
});
$('.legendpropernoun, .NNP, .NNPS').click(
function() {
$('.legendpropernoun, .NNP, .NNPS').toggleClass('propernoun');
});
$('.legendadverb, .RB').click(
function() {
$('.legendadverb, .RB').toggleClass('adverb');
});
$('.legendadverb-comparative-superative, .RBR, .JJR, .RBS').click(
function() {
$('.legendadverb-comparative-superative, .RBR, .JJR, .RBS').toggleClass('adverb-comparative-superative');
});
$('.legendhide, .TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .comma, .dot').click(function() {
$('.legendhide, .TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .comma, .dot').toggleClass('hide');
});
/* multiple click to change css */
$(function() {
$('.legendverb, .VB, .VBZ, .VBN, .VVD').each(function() {
var count = 0;
$('.legendverb, .VB, .VBZ, .VBN, .VVD').click(function(){
count++;
if (count === 1) {
$('.legendverb, .VB, .VBZ, .VBN, .VVD').addClass('verb');
}
else if(count === 2){
$('.legendverb, .VB, .VBZ, .VBN, .VVD').removeClass('verb');
$('.legendverb, .VB, .VBZ, .VBN, .VVD').addClass('verb-bg');
}
else{
$('.legendverb, .VB, .VBZ, .VBN, .VVD').removeClass('verb-bg');
count = 0;
}
});
});
});
/* Image cick to make bigger */
$('.image').click(
function() {
$(this).toggleClass('img_clicked');
});
$('.t_image').click(
function() {
$(this).toggleClass('t_img_clicked');
})
});
});
// /* multiple click to change css */
// $(function() {
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').each(function() {
// var count = 0;
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').click(function(){
// count++;
// if (count === 1) {
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').addClass('verb');
// }
// else if(count === 2){
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').removeClass('verb');
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').addClass('verb-bg');
// }
// else{
// $('.legendverb, .VB, .VBZ, .VBN, .VVD').removeClass('verb-bg');
// count = 0;
// }
// });
// });
// });