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.

422 lines
16 KiB
JavaScript

/* scroll and position fix the legend */
$(window).scroll(function(){
if ($(this).scrollTop() > 310) {
$('.legend').addClass('legendfixed');
} else {
$('.legend').removeClass('legendfixed');
}
});
$(window).scroll(function(){
if ($(this).scrollTop() > 310) {
$('.img').addClass('imgfixed');
$('.t_img').addClass('t_imgfixed');
} else {
$('.img').removeClass('imgfixed');
$('.t_img').removeClass('t_imgfixed');
}
});
/* hover to highlight words */
$(document).ready(function() {
// /* on mousehover: frequent words highlight on the paragraph*/
// $('.top_words > .chosen_words').mouseover( function(){
// var word = $(this).text().toLowerCase().slice(0,-5);
// console.log(word)
// $(word).attr('class').css('color','blue');
// });
// $('.t_chosen_words').click( function(){
// var word = $(this).text();
// alert(word);
// });
/* legend & pos tag highlights */
$('.legendverb').mouseover(function(){ $('.legendverb').css('background-color', 'yellow'); });
$('.legendverb').mouseout(function(){ $('.legendverb').css('background-color', 'transparent').css('color', 'black'); });
$('.legendnoun').mouseover(function(){ $('.legendnoun').css('background-color', 'springgreen'); });
$('.legendnoun').mouseout(function(){ $('.legendnoun').css('background-color', 'transparent').css('color', 'black'); });
$('.legendadjective').mouseover(function(){ $('.legendadjective').css('background-color', 'blue').css('color', 'white'); });
$('.legendadjective').mouseout(function(){ $('.legendadjective').css('background-color', 'transparent').css('color', 'black'); });
$('.legendadverb').mouseover(function(){ $('.legendadverb').css('background-color', 'purple').css('color', 'white'); });
$('.legendadverb').mouseout(function(){ $('.legendadverb').css('background-color', 'transparent').css('color', 'black'); });
$('.legendpossesivepronoun').mouseover(function(){ $('.legendpossesivepronoun').css('background-color', 'red').css('color', 'white'); });
$('.legendpossesivepronoun').mouseout(function(){ $('.legendpossesivepronoun').css('background-color', 'transparent').css('color', 'black'); });
$('.legendpresentparticiple').mouseover(function(){ $('.legendpresentparticiple').css('background-color', 'brown').css('color', 'white');; });
$('.legendpresentparticiple').mouseout(function(){ $('.legendpresentparticiple').css('background-color', 'transparent').css('color', 'black'); });
$('.legendadjectivesuperlative').mouseover(function(){ $('.legendadjectivesuperlative').css('background-color', 'salmon').css('color', 'white'); });
$('.legendadjectivesuperlative').mouseout(function(){ $('.legendadjectivesuperlative').css('background-color', 'transparent').css('color', 'black'); });
$('.legendadverb-comparative-superative').mouseover(function(){ $('.legendadverb-comparative-superative').css('background-color', 'lightgreen').css('color', 'black'); });
$('.legendadverb-comparative-superative').mouseout(function(){ $('.legendadverb-comparative-superative').css('background-color', 'transparent').css('color', 'black'); });
$('.legendpropernoun').mouseover(function(){ $('.legendpropernoun').css('background-color', 'pink'); });
$('.legendpropernoun').mouseout(function(){ $('.legendpropernoun').css('background-color', 'transparent').css('color', 'black'); });
$('.legendcurrencysign').mouseover(function(){ $('.legendcurrencysign').css('background-color', 'deepskyblue'); });
$('.legendcurrencysign').mouseout(function(){ $('.legendcurrencysign').css('background-color', 'transparent').css('color', 'black'); });
$('.legendhide').mouseover(function(){ $('.legendhide').css('background-color', 'black').css('color', 'white'); });
$('.legendhide').mouseout(function(){ $('.legendhide').css('background-color', 'transparent').css('color', 'black'); });
//get other iframe
var other = $(window.parent.document).find('iframe.viewer').filter( function() {
return this.contentWindow!==window;
});
// click to highlight words + remove words + turn off hightlight
//stopwords
$('.legendhide, .TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .LS, .comma, .dot').click(function() {
if ($('.legendhide').hasClass('legendhide-clicked')) {
$('.legendhide').removeClass('legendhide-clicked');
$('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .LS, .comma, .dot').removeClass('hide');
other.contents().find('.legendhide').removeClass('legendhide-clicked');
other.contents().find('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .LS, .comma, .dot').removeClass('hide');
}
else {
$('.legendhide').addClass('legendhide-clicked');
$('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .LS, .comma, .dot').addClass('hide');
other.contents().find('.legendhide').addClass('legendhide-clicked');
other.contents().find('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC, .VBP, .WRB, .marks, .CD, .LS, .comma, .dot').addClass('hide');
}
});
//verb
$('.legendverb, .VB, .VBZ, .VBN, .VBD').click(function() {
if ($('.legendverb').hasClass('verb')) {
$('.legendverb').removeClass('verb').addClass('legendverb-clicked');
$('.VB, .VBZ, .VBN, .VBD').removeClass('verb').addClass('bg-verb');
other.contents().find('.legendverb').removeClass('verb').addClass('legendverb-clicked');
other.contents().find('.VB, .VBZ, .VBN, .VBD').removeClass('verb').addClass('bg-verb');
}
else if ($('.legendverb').hasClass('legendverb-clicked')) {
$('.legendverb').removeClass('legendverb-clicked');
$('.VB, .VBZ, .VBN, .VBD').removeClass('bg-verb');
other.contents().find('.legendverb').removeClass('legendverb-clicked');
other.contents().find('.VB, .VBZ, .VBN, .VBD').removeClass('bg-verb');
}
else {
$('.legendverb, .VB, .VBZ, .VBN, .VBD').addClass('verb');
other.contents().find('.legendverb, .VB, .VBZ, .VBN, .VBD').addClass('verb');
}
});
//adjective
$('.legendadjective, .JJ').click(function() {
if ($('.legendadjective').hasClass('adjective')) {
$('.legendadjective').removeClass('adjective').addClass('legendadjective-clicked');
$('.JJ').removeClass('adjective').addClass('bg-adjective');
other.contents().find('.legendadjective').removeClass('adjective').addClass('legendadjective-clicked');
other.contents().find('.JJ').removeClass('adjective').addClass('bg-adjective');
}
else if ($('.legendadjective').hasClass('legendadjective-clicked')) {
$('.legendadjective').removeClass('legendadjective-clicked');
$('.JJ').removeClass('bg-adjective');
other.contents().find('.legendadjective').removeClass('legendadjective-clicked');
other.contents().find('.JJ').removeClass('bg-adjective');
}
else {
$('.legendadjective, .JJ').addClass('adjective');
other.contents().find('.legendadjective, .JJ').addClass('adjective');
}
});
//Possesive pronoun
$('.legendpossesivepronoun, .PRPS').click(function() {
if ($('.legendpossesivepronoun').hasClass('possesivepronoun')) {
$('.legendpossesivepronoun').removeClass('possesivepronoun').addClass('legendpossesivepronoun-clicked');
$('.PRPS').removeClass('possesivepronoun').addClass('bg-possesivepronoun');
other.contents().find('.legendpossesivepronoun').removeClass('possesivepronoun').addClass('legendpossesivepronoun-clicked');
other.contents().find('.PRPS').removeClass('possesivepronoun').addClass('bg-possesivepronoun');
}
else if ($('.legendpossesivepronoun').hasClass('legendpossesivepronoun-clicked')) {
$('.legendpossesivepronoun').removeClass('legendpossesivepronoun-clicked');
$('.PRPS').removeClass('bg-possesivepronoun');
other.contents().find('.legendpossesivepronoun').removeClass('legendpossesivepronoun-clicked');
other.contents().find('.PRPS').removeClass('bg-possesivepronoun');
}
else {
$('.legendpossesivepronoun, .PRPS').addClass('possesivepronoun');
other.contents().find('.legendpossesivepronoun, .PRPS').addClass('possesivepronoun');
}
});
//Noun
$('.legendnoun, .NN, .NNS').click(function() {
if ($('.legendnoun').hasClass('noun')) {
$('.legendnoun').removeClass('noun').addClass('legendnoun-clicked');
$('.NN, .NNS').removeClass('noun').addClass('bg-noun');
other.contents().find('.legendnoun').removeClass('noun').addClass('legendnoun-clicked');
other.contents().find('.NN, .NNS').removeClass('noun').addClass('bg-noun');
}
else if ($('.legendnoun').hasClass('legendnoun-clicked')) {
$('.legendnoun').removeClass('legendnoun-clicked');
$('.NN, .NNS').removeClass('bg-noun');
other.contents().find('.legendnoun').removeClass('legendnoun-clicked');
other.contents().find('.NN, .NNS').removeClass('bg-noun');
}
else {
$('.legendnoun, .NN, .NNS').addClass('noun');
other.contents().find('.legendnoun, .NN, .NNS').addClass('noun');
}
});
//proper noun
$('.legendpropernoun, .NNP, .NNPS').click(function() {
if ($('.legendpropernoun').hasClass('propernoun')) {
$('.legendpropernoun').removeClass('propernoun').addClass('legendpropernoun-clicked');
$('.NNP, .NNPS').removeClass('propernoun').addClass('bg-propernoun');
other.contents().find('.legendpropernoun').removeClass('propernoun').addClass('legendpropernoun-clicked');
other.contents().find('.NNP, .NNPS').removeClass('propernoun').addClass('bg-propernoun');
}
else if ($('.legendpropernoun').hasClass('legendpropernoun-clicked')) {
$('.legendpropernoun').removeClass('legendpropernoun-clicked');
$('.NNP, .NNPS').removeClass('bg-propernoun');
other.contents().find('.legendpropernoun').removeClass('legendpropernoun-clicked');
other.contents().find('.NNP, .NNPS').removeClass('bg-propernoun');
}
else {
$('.legendpropernoun, .NNP, .NNPS').addClass('propernoun');
other.contents().find('.legendpropernoun, .NNP, .NNPS').addClass('propernoun');
}
});
//Adverb
$('.legendadverb, .RB').click(function() {
if ($('.legendadverb').hasClass('adverb')) {
$('.legendadverb').removeClass('adverb').addClass('legendadverb-clicked');
$('.RB').removeClass('adverb').addClass('bg-adverb');
other.contents().find('.legendadverb').removeClass('adverb').addClass('legendadverb-clicked');
other.contents().find('.RB').removeClass('adverb').addClass('bg-adverb');
}
else if ($('.legendadverb').hasClass('legendadverb-clicked')) {
$('.legendadverb').removeClass('legendadverb-clicked');
$('.RB').removeClass('bg-adverb');
other.contents().find('.legendadverb').removeClass('legendadverb-clicked');
other.contents().find('.RB').removeClass('bg-adverb');
}
else {
$('.legendadverb, .RB').addClass('adverb');
other.contents().find('.legendadverb, .RB').addClass('adverb');
}
});
//Present Participle
$('.legendpresentparticiple, .VBG').click(function() {
if ($('.legendpresentparticiple').hasClass('presentparticiple')) {
$('.legendpresentparticiple').removeClass('presentparticiple').addClass('legendpresentparticiple-clicked');
$('.VBG').removeClass('presentparticiple').addClass('bg-presentparticiple');
other.contents().find('.legendpresentparticiple').removeClass('presentparticiple').addClass('legendpresentparticiple-clicked');
other.contents().find('.VBG').removeClass('presentparticiple').addClass('bg-presentparticiple');
}
else if ($('.legendpresentparticiple').hasClass('legendpresentparticiple-clicked')) {
$('.legendpresentparticiple').removeClass('legendpresentparticiple-clicked');
$('.VBG').removeClass('bg-presentparticiple');
other.contents().find('.legendpresentparticiple').removeClass('legendpresentparticiple-clicked');
other.contents().find('.VBG').removeClass('bg-presentparticiple');
}
else {
$('.legendpresentparticiple, .VBG').addClass('presentparticiple');
other.contents().find('.legendpresentparticiple, .VBG').addClass('presentparticiple');
}
});
//Adjective Superlative
$('.legendadjectivesuperlative, .JJS').click(function() {
if ($('.legendadjectivesuperlative').hasClass('adjectivesuperlative')) {
$('.legendadjectivesuperlative').removeClass('adjectivesuperlative').addClass('legendadjectivesuperlative-clicked');
$('.JJS').removeClass('adjectivesuperlative').addClass('bg-adjectivesuperlative');
other.contents().find('.legendadjectivesuperlative').removeClass('adjectivesuperlative').addClass('legendadjectivesuperlative-clicked');
other.contents().find('.JJS').removeClass('adjectivesuperlative').addClass('bg-adjectivesuperlative');
}
else if ($('.legendadjectivesuperlative').hasClass('legendadjectivesuperlative-clicked')) {
$('.legendadjectivesuperlative').removeClass('legendadjectivesuperlative-clicked');
$('.JJS').removeClass('bg-adjectivesuperlative');
other.contents().find('.legendadjectivesuperlative').removeClass('legendadjectivesuperlative-clicked');
other.contents().find('.JJS').removeClass('bg-adjectivesuperlative');
}
else {
$('.legendadjectivesuperlative, .JJS').addClass('adjectivesuperlative');
other.contents().find('.legendadjectivesuperlative, .JJS').addClass('adjectivesuperlative');
}
});
//adverb-comparative-superative
$('.legendadverb-comparative-superative, .RBR, .JJR, .RBS').click(function() {
if ($('.legendadverb-comparative-superative').hasClass('adverb-comparative-superative')) {
$('.legendadverb-comparative-superative').removeClass('adverb-comparative-superative').addClass('legendadverb-comparative-superative-clicked');
$('.RBR, .JJR, .RBS').removeClass('adverb-comparative-superative').addClass('bg-adverb-comparative-superative');
other.contents().find('.legendadverb-comparative-superative').removeClass('adverb-comparative-superative').addClass('legendadverb-comparative-superative-clicked');
other.contents().find('.RBR, .JJR, .RBS').removeClass('adverb-comparative-superative').addClass('bg-adverb-comparative-superative');
}
else if ($('.legendadverb-comparative-superative').hasClass('legendadverb-comparative-superative-clicked')) {
$('.legendadverb-comparative-superative').removeClass('legendadverb-comparative-superative-clicked');
$('.RBR, .JJR, .RBS').removeClass('bg-adverb-comparative-superative');
other.contents().find('.legendadverb-comparative-superative').removeClass('legendadverb-comparative-superative-clicked');
other.contents().find('.RBR, .JJR, .RBS').removeClass('bg-adverb-comparative-superative');
}
else {
$('.legendadverb-comparative-superative, .RBR, .JJR, .RBS').addClass('adverb-comparative-superative');
other.contents().find('.legendadverb-comparative-superative, .RBR, .JJR, .RBS').addClass('adverb-comparative-superative');
}
});
//currencysign
$('.legendcurrencysign, .currencysign2').click(function() {
if ($('.legendcurrencysign').hasClass('currencysign')) {
$('.legendcurrencysign').removeClass('currencysign').addClass('legendcurrencysign-clicked');
$('.currencysign2').removeClass('currencysign').addClass('bgcurrencysign');
other.contents().find('.legendcurrencysign').removeClass('currencysign').addClass('legendcurrencysign-clicked');
other.contents().find('.currencysign2').removeClass('currencysign').addClass('bgcurrencysign');
}
else if ($('.legendcurrencysign').hasClass('legendcurrencysign-clicked')) {
$('.legendcurrencysign').removeClass('legendcurrencysign-clicked');
$('.currencysign2').removeClass('bgcurrencysign');
other.contents().find('.legendcurrencysign').removeClass('legendcurrencysign-clicked');
other.contents().find('.currencysign2').removeClass('bgcurrencysign');
}
else {
$('.legendcurrencysign, .currencysign2').addClass('currencysign');
other.contents().find('.legendcurrencysign, .currencysign2').addClass('currencysign');
}
});
// /* Image cick to make bigger */
// $('.image').click(
// function() {
// $(this).toggleClass('img_clicked');
// });
// $('.t_image').click(
// function() {
// $(this).toggleClass('t_img_clicked');
// })
});