$( document ).ready(function() {
var sheet = (function() {
var style = document.createElement("style");
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
return style.sheet;
})();
sheet.insertRule("@media only screen and (max-width: 910px) {.scrak_CONTFB { display:none }} ",0);
sheet.insertRule("@media only screen and (min-width: 910px) {.scrak_CONTFB{width:40px; background-color:#403e3e ;cursor: pointer; cursor: hand;padding:4px;margin-left:45px; height:40px; }} ",1);
sheet.insertRule(".scrak_CONTFB_keski { height:30px;display: table-cell;cursor: pointer; cursor: hand; padding:5px;background-color:#403e3e; font-size:10px;vertical-align:middle;alignment-baseline:middle}",2);
sheet.insertRule(".scrak_CONTFB_keskib { height:30px;display: table-cell;cursor: pointer; cursor: hand; padding:5px;background-color:#403e3e; font-size:10px;vertical-align:middle;alignment-baseline:middle}",3);
sheet.insertRule(".scrak_CONTFB_keskic {width:30%; height:15px;display: table-cell;cursor: pointer; cursor: hand; padding:5px;background-color:#403e3e; font-size:10px;vertical-align:middle;alignment-baseline:middle}",4);
sheet.insertRule(".scrak_CONTSWG{height:35px;width:35px; float:left;}",5);
sheet.insertRule(".scrak_CONTSWGc{height:20px;width:15px; float:left;}",6);
sheet.insertRule(".scrak_NIM{vertical-align:middle; height:35px;display:table-cell; font-size:12px; color:white;}",7);
sheet.insertRule(".scrak_NIMc{vertical-align:middle; height:20px;display:table-cell; font-size:10px; color:white;padding-left:2px}",8);
sheet.insertRule(".fb_ac{ background-color:#3b5998; }",9);
sheet.insertRule(".what_ac{ background-color:#4dc247; }",10);
sheet.insertRule(".pint_ac{ background-color:#bd081c; }",11);
sheet.insertRule(".lnki_ac{ background-color:#0077b5; }",12);
sheet.insertRule(".gpplus_ac{ background-color:#3b5998; }",13);
sheet.insertRule(".tweet_ac{ background-color:#1da1f2; }",14);
sheet.insertRule(".mail_ac{ background-color:#848484; }",15);
sheet.insertRule(".fbmaarajakoa{ background-color:#1b2743; border-radius: 15px; padding:2px 6px; margin-left:3px;display:none }",16);
sheet.insertRule(".scjako{display:table-cell; }",17);
sheet.insertRule("@media only screen and (max-width: 760px) {.scrak_NIM { display:none }} ",18);
sheet.insertRule(".seuraava_ac{ background-color:#565656; }",19);
sheet.insertRule("@media only screen and (max-width: 760px) {.lnki_ac { display:none }} ",20);
sheet.insertRule("@media only screen and (max-width: 760px) {.lnki_ac { display:none }} ",21);
sheet.insertRule("@media only screen and (max-width: 760px) {.gpplus_ac { display:none }} ",22);
sheet.insertRule(".sydan_ac{ background-color:#c1c1c1; }",23);
sheet.insertRule('.whjako{display:none}',23);
var scrakentajafi_share_common_v = '';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
//scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
<
';
scrakentajafi_share_common_v = scrakentajafi_share_common_v + '
';
$('.scrakentajafi_share_common').html(scrakentajafi_share_common_v);
var scrak_valikko = '-=50';
var scrak_valikkob = '+=25';
$( "#scrak_CONT" ).animate({
left: '+=50'
}, 600, function() {
// Animation complete.
});
$('.scrak_CONTFB').hover(
function() {
$(this).animate({
'marginLeft': '+=10'
}, 300, function() {
// Animation complete.
});
}, function() {
$(this).animate({
'marginLeft': '-=10'
}, 300, function() {
// Animation complete.
});
}
);
$('#scrak_piilo').click(function() {
if (scrak_valikko =='+=50') {
$('#scrak_piilo').css('marginLeft','-=25px');
}
$( "#scrak_CONT" ).animate({
left: scrak_valikko
}, 300, function() {
if (scrak_valikko =='+=50') {
scrak_valikko = '-=50';
} else {
scrak_valikko = '+=50';
}
$( "#scrak_piilo" ).animate({
marginLeft: scrak_valikkob
}, 300, function() {
if (scrak_valikkob =='+=25') {
scrak_valikkob = '=0';
$('#scrak_piilo').html('>');
} else {
scrak_valikkob = '+=25';
$('#scrak_piilo').html('<');
}
});
});
});
//mobiili alapalkki
var innerhtml_keskio = '';
innerhtml_keskio = innerhtml_keskio + '';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
//innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
$('.scrakentajafi_share').html(innerhtml_keskio);
$('.scrak_CONTFB_keskib').hover(
function() {
$(this).animate({
'opacity': '-=0.5'
}, 300, function() {
// Animation complete.
});
}, function() {
$(this).animate({
'opacity': '+=0.5'
}, 300, function() {
// Animation complete.
});
}
);
var innerhtml_keskio = '';
innerhtml_keskio = innerhtml_keskio + '';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
$('.scrakentajafi_keskio_share').html(innerhtml_keskio);
$('.scrak_CONTFB_keski').hover(
function() {
$(this).animate({
'opacity': '-=0.5'
}, 300, function() {
// Animation complete.
});
}, function() {
$(this).animate({
'opacity': '+=0.5'
}, 300, function() {
// Animation complete.
});
}
);
var innerhtml_keskio = '';
innerhtml_keskio = innerhtml_keskio + '';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
innerhtml_keskio = innerhtml_keskio + '
';
$('.scrakentajafi_keskio2_share').html(innerhtml_keskio);
$('.scrak_CONTFB_keskic').hover(
function() {
$(this).animate({
'opacity': '-=0.5'
}, 300, function() {
// Animation complete.
});
}, function() {
$(this).animate({
'opacity': '+=0.5'
}, 300, function() {
// Animation complete.
});
}
);
$('.fbjako').click(function() {
window.open('https://www.facebook.com/dialog/share?%20app_id=242351771255&display=popup&href=' + encodeURI(window.location.href) + '&redirect_uri=' + encodeURI(window.location.href) , '_blank', 'toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500');
ga('send', 'event', 'SOME', 'FB_' + this.id, encodeURI(window.location.href));
});
$('.whjako').click(function() {
window.open('whatsapp://send?text=' + encodeURI(window.location.href), '_self', 'toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500');
ga('send', 'event', 'SOME', 'WHATASAPP_' + this.id, encodeURI(window.location.href));
});
$('.sydanjako').click(function() {
$.ajax({type: "GET",
crossDomain : true,
crossOrigin: true,
url: "//sc.rakentaja.fi/suosikki.aspx?kkv=" + $.cookie("RKkavija") + "&host=" + location.host + "&VLkavija=" + $.cookie("VLkavija") + "&sk4=" + $.cookie("sk4") + "&jsonp=jsonstring&callback=?",
dataType: "jsonp",
jsonp: "jsonp",
jsonpCallback: "jsonstring",
success: function (msg) {
console.log('onnistui');
$('.at-icon-sydan').css('fill', 'red');
ga('send', 'event', 'SOME', 'SYDANSUOSIKKI_' + this.id, encodeURI(window.location.href));
},
error: function(){
console.log('virhe');
}
});
});
$('.pintjako').click(function() {
window.open("https://www.pinterest.com/pin/create/link/?url=" + encodeURI(window.location.href) , "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
ga('send', 'event', 'SOME', 'PINTEREST_' + this.id, encodeURI(window.location.href));
});
$('.linkedjako').click(function() {
window.open("https://www.linkedin.com/shareArticle?mini=true&url=" + encodeURI(window.location.href) + "&ro=false&summary=&source=", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
ga('send', 'event', 'SOME', 'LINKEDIN_' + this.id, encodeURI(window.location.href));
});
$('.gpljako').click(function() {
window.open("https://plus.google.com/share?url=" + encodeURI(window.location.href) + "&ro=false&summary=&source=", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
ga('send', 'event', 'SOME', 'GPLUS_' + this.id, encodeURI(window.location.href));
});
$('.tweetjako').click(function() {
window.open("https://twitter.com/intent/tweet?url=" + encodeURI( window.location.href), "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
ga('send', 'event', 'SOME', 'TWITTER_' + this.id, encodeURI(window.location.href));
});
$('.mailjako').click(function() {
window.open("https://www.rakentaja.fi/suorakanava/kerrokaverille.asp?sivulinkki=" + encodeURI( window.location.href), "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,width=500,height=500");
ga('send', 'event', 'SOME', 'KAVERILLE_' + this.id, encodeURI(window.location.href));
});
$('.seuraavaartikkeli').click(function() {
ga('send', 'event', 'SOME', 'SEURAAVA_MOBILE_' + this.id, encodeURI(window.location.href));
location.href = this.href;
});
$('.seuraavaartikkeli').click(function() {
var scurl = this.href;
ga('send', 'event', 'SOME', 'SEURAAVA_MOBILE', scurl, {
'transport': 'beacon',
'hitCallback': function(){document.location = scurl;}
});
return false;
});
//SUOSITELTUJA.
var nostobo = '';
nostobo = nostobo + '
Sinulle suositeltuja
';
nostobo = nostobo + '
';
nostobo = nostobo + '
';
$('.scrakentajafi_share_nosto').html(nostobo);
var available;
var percentage_of_page;
var half_screen;
var height;
var scasento;
scasento = 0;
$(window).scroll(function (e) {
available = $(document).height();
percentage_of_page = 0.5;
half_screen = available * percentage_of_page;
height = $(window).scrollTop();
if ( height > half_screen ) {
if (scasento == 0) {
scasento = 1;
$('#scraken_nsoto').animate({
'bottom': '+=150'
}, 300, function() {
});
}
} else {
if (scasento == 1) {
scasento = 0;
$('#scraken_nsoto').animate({
'bottom': '-=150'
}, 300, function() {
});
}
}
});
function showObjectjQuery(obj) {
var result = "";
$.each(obj, function(k, v) {
result += k + " , " + v + "\n";
});
return result;
}
function haelisaa(){
$.ajax({type: "GET",
crossDomain : true,
crossOrigin: true,
url: "//sc.rakentaja.fi/index_oikea.aspx?usu=1&nro=1&kkv=" + $.cookie("RKkavija") + "&host=" + location.host + "&jsonp=jsonstring&callback=?",
dataType: "jsonp",
jsonp: "jsonp",
jsonpCallback: "jsonstring",
success: function (msg) {
var items = [];
var scrak_max = 0;
$.each(msg, function(k, v) {
if (scrak_max < 4) {
items.push('');
scrak_max += 1;
}
});
$( "#scrakentaja_nosto").append( items.join( "" ) );
if (scrak_max==0){
$('#scraken_nsoto').css('display', 'none');
}
$('.rcsuositteluturl').click(function() {
var scurl = this.href;
ga('send', 'event', 'SOME', 'SUOSITELTUJA', scurl, {
'transport': 'beacon',
'hitCallback': function(){document.location = scurl;}
});
return false;
});
},
error: function(){
console.log('virhe');
$('#scraken_nsoto').css('display', 'none');
}
});
}
console.log('hae');
haelisaa();
var scrakala_valikko = '-=120';
$('#scraken_title').click(function() {
$('#scraken_nsoto').animate({
'bottom': scrakala_valikko
}, 300, function() {
// Animation complete.
if (scrakala_valikko == '-=120') {
scrakala_valikko = '+=120';
} else {
scrakala_valikko = '-=120';
}
});
});
});