<div id="NTBIRIX" style="margin-bottom:24px;"></div>
<amedia-include lazy="false" cssassets="//r.acdn.no/s3files/castor/arena/0.8.26/css/design2.css,//r.acdn.no/s3files/castor/arena/0.8.26/css/escenic.css,//r.acdn.no/api/shoal/v1/single_bundle/527dcfd753c83c76591d64ed22b6bba2d187f6b1cdbd13dd7a2355a6f65526bc" jsassets="" src="/api/loafer/v1/components/personalia_frontpage/www.gd.no/embed/"></amedia-include>
<div id="debatt_tagflyt"></div> <script type="text/javascript"> // Tre saker fra debattfronten // Tre lister: Mest lest, mest delt, mest kommentert (siste dag/uke) // Grid på desktop, 1+2 + liste på bobil // Kommentar skal ha bylinebilde // Alt skal ha fonten // Leserbrev merkes tydelig. createMobileSection('debatt', 3); function createMobileSection(tag, length){ if (tag == "debatt"){ var url = '//data.gd.no/data/json/?data=front_list&front=57'; } else { var url = '//data.gd.no/data/json/?type=opinion&tag_acp='+tag; } $.getJSON(url, function(data) { var intro = "Aktuell debatt"; $("#"+tag+"_tagflyt").parents('section').attr('id', tag+'_punkt'); $("#"+tag+"_tagflyt").parents('section').css('display', 'none'); $("#"+tag+"_punkt").after(createMobileTriplet(data, tag, intro)); $("."+tag+"_plustwo").append(fillMobileTriple(data,2)); $("."+tag+"_plustwo").append(fillMobileTriple(data,1)); }); } function fillList(scheme, emne, lengde){ $('#'+emne+'ListItems').html(''); var sorteringsstreng = '&sortering=siste'; var emnestreng = '&emne='+emne; $.getJSON("//data.gd.no/data/json/?data=anbefalinger"+sorteringsstreng+emnestreng, function(data){ for(i = 0; i< lengde ; i++){ if (i == 0){ var first = true; } else { var first = false; } listItem(data[i]['uid'],data[i]['url'],data[i]['title'],data[i]['lukket'],data[i]['time'],data[i]['dice'],first, 'siste', i, scheme, emne); } }); } function listItem(uid,url,title,lukket,tid,terning,first, sortering, nummer, scheme, liste){ var html = ''; tid = new Date(tid); naa = Math.round(Date.now() / 1000); var siden = naa-Math.round(tid / 1000); var maned = 1 + tid.getMonth(); var dag = 0 + tid.getDate(); var timer = 0 + tid.getHours(); var minutter = tid.getMinutes(); var fulleMinutter = pad(minutter, 2); var fulleTimer = pad(timer, 2); var fulleDager = pad(dag, 2); if (maned == 1){ var fulleManeder = 'jan'; } else if (maned == 2){ var fulleManeder = 'feb'; } else if (maned == 3){ var fulleManeder = 'mar'; } else if (maned == 4){ var fulleManeder = 'apr'; } else if (maned == 5){ var fulleManeder = 'mai'; } else if (maned == 6){ var fulleManeder = 'jun'; } else if (maned == 7){ var fulleManeder = 'jul'; } else if (maned == 8){ var fulleManeder = 'aug'; } else if (maned == 9){ var fulleManeder = 'sep'; } else if (maned == 10){ var fulleManeder = 'okt'; } else if (maned == 11){ var fulleManeder = 'nov'; } else if (maned == 12){ var fulleManeder = 'des'; } if (liste == "lest"){ if(!first) {html += '<hr style="border:1px #ffffff dashed;">';} } else { if(!first) {html += '<hr style="border:1px #ffffff dashed;">';} } if(terning != undefined){ html += '<i class="am-icon am-icon--dice-0' + terning + ' am-color--white" aria-hidden="true"></i>' + ' | ';} else if(sortering == 'siste' || sortering == 'author'){ if (siden < 900 ){ html += '<span style="font-weight:bold;">Ny:</span> '; } else if (siden < 40000) { html += fulleTimer + ':' + fulleMinutter + ' | '; } else { html += fulleDager + '. ' + fulleManeder + ' | '; } } else { html += parseInt(i) + 1; html += '. '; } if(lukket == 'true'){ console.log(lukket); html += '<object class="am-premium-logo am-premium-logo--large" type="image/svg+xml" data="http://r.api.no/local/v3/publications/default/gfx/subscription/pluss_icon.svg" style="width:12px;height:12px;"></object> '; } html += '<a class="relevantLink" href="'; html += url; if (liste == "lest"){ html += '" style="color:#333333;text-decoration:none;">'; } else { if(scheme != '' && scheme != "debatt"){ html += '" style="color:white;text-decoration:none;">'; } else if (scheme == "debatt"){ html += '" style="color:black;text-decoration:none;">'; } else { html += '">'; }} html += title; html += '</a>'; $('#'+liste+'ListItems').append(html); } function insertList(name, section, tag){ var tittel = "Siste "+tag; if (tag == 'leder'){tittel += "e:";} if (tag == 'kommentar'){tittel += "er:";} if (tag == 'leserbrev'){tittel += ":";} var liste = tag; var bgc = '#feffbe'; var fgc = '#e9d14f'; var tc = '#000000'; var listhtml = '<div class="am-gridComp-item"><div class="am-embed"><div id="'+liste+'List" style="width:100%;color: '+tc+';background-color:'+bgc+'; padding:10px; margin-top:10px; margin-bottom:5px;"><b>'+tittel+'</b><hr style="border:3px '+fgc+' solid;width:160px;text-align:left;margin-left:0"><div style="width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" id="'+liste+'ListItems"></div></div></div></div>'; $('#'+name+section).append(listhtml); } function insertMobile(nr,size,tag,section,data){ if (size > 29){ minsize = '180'; } if (size > 49){ minsize += ' 230 330 430'; } if (size > 69){ minsize += ' 530 730'; } console.log(data); var article = buildMobile(data[nr]['tittel'],data[nr]['uid'],data[nr]['bildeadresse'],data[nr]['bilderatio'],data[nr]['adresse'], minsize, data[nr]['lukket'], data[nr]['vignett'], tag); var sel_target = '#'+tag+section; var target = $(sel_target); $(sel_target).append(article); } function buildMobile(title,id,image,ratio,link,size,closed,vignett,tag){ var windowUrl = location.href; var n = windowUrl.indexOf("mobil"); var html =''; if (n == "-1"){ html += '<div class="am-gridComp-item">'; } else { html += '<li class="am-articleCollection-item">'; } html += '<article class="am-articleEntry am-js-responsiveElement am-articleEntry--story" itemscope="" itemtype="http://schema.org/NewsArticle" data-minwidth="'; html += size; html +='">'; html += '<a href="'; html += link; html += '" class="am-articleEntry-link" itemprop="url">'; html += '<div class="am-runningHead am-runningHead--opinion">'; if (vignett != ''){ html+= vignett; } else { if(tag == "Leder"){html += 'GD mener';} else if(tag == "Kommentar"){html += 'Kommentar';} else if(tag == "Leserbrev"){html += 'Leserbrev';} else { html += tag;} } // if(current_tag == "debatt"){html += 'Debatt';} html += '</div>'; html += '<div class="am-articleEntry-main">'; html += '<figure class="am-gridComp-item-inlineObject am-articleEntry-mainFig" itemscope="" itemtype="http://schema.org/ImageObject">'; html += '<div class="am-articleEntry-mainFig-inner am-overlay" style="padding-top:'+ratio+'%">'; if (closed === true){ html += '<div class="am-premium-flex--wrapper">'; html += '<div class="am-premium-flex--row">'; html += '<object class="am-premium-logo am-premium-logo--large" type="image/svg+xml" data="http://r.api.no/local/v3/publications/default/gfx/subscription/pluss_icon.svg"></object>'; html += '</div>'; html += '</div>'; } html += '<img src="'; // html += 'http://interaktiv.gd.no/widgets/img_cache/img_cacher_x4.php?id='; html += '//46.101.112.222/data/images/x4_cache/img_cacher_x4.php?id='; html += id; html +='&url='; html += image; html += '" class="am-figure-img am-article-mainFig-img" itemprop="contentURL">'; html += '</div>'; html += '</figure>'; html += '<div class="am-articleEntry-body">'; html += '<h2 class="am-articleEntry-mainTitle am-txt--head am-articleEntry-mainTitle--opinion " itemprop="headline">'; html += title; html += '</h2>'; html += '</div>'; html += '</div>'; html += '</a>'; html += '</article>'; if (n === "-1"){ html += '</div>'; } else { html += '</li>'; } return html; } function createMobileTriplet(data, tag, intro){ var html =''; html +='<section class="am-gridComp am-gridComp--1" style="background-color:#e9d14f">'; html +='<div style="width:100%;font-family:gsb;line-height:40px;padding-left:20px;">'+intro+'</div>'; html +='<div class="am-gridComp-body" style="margin-bottom: 0px;">'; html +='<div class="am-gridComp-items">'; html +='<div class="am-gridComp-item">'; html +='<article id="b6feb8" class="am-articleEntry am-js-responsiveElement am-articleEntry--story" itemscope="" itemtype="http://schema.org/NewsArticle" data-minwidth="330">'; html +='<a href="'+data[0]['adresse']+'" class="am-articleEntry-link" itemprop="url">'; html +='<div class="am-articleEntry-main">'; html +='<figure class="am-gridComp-item-inlineObject am-articleEntry-mainFig" itemscope="" itemtype="http://schema.org/ImageObject">'; html +='<div class="am-articleEntry-mainFig-inner am-overlay" style="padding-top:'+data[0]['bilderatio']+'%">'; if (data[0]['lukket'] = true){ html += '<div class="am-premium-flex--wrapper" style="display:none;">'; html += '<div class="am-premium-flex--row">'; html += '<object class="am-premium-logo am-premium-logo--large" type="image/svg+xml" data="http://r.api.no/local/v3/publications/default/gfx/subscription/pluss_icon.svg"></object>'; html += '</div>'; html += '</div>'; } html +='<img src="'+data[0]['bildeadresse']+'" class="am-figure-img am-article-mainFig-img" itemprop="contentURL">'; html +='</div>'; html +='</figure>'; html +='<div class="am-articleEntry-body" style="background-color:#ffffff;padding:5px;">'; html +='<span style="color:#e9d14f;font-size:.875rem;font-weight:bold;text-transform:uppercase;">'+data[0]['vignett']+'</span><h2 class="am-articleEntry-mainTitle am-txt--head " itemprop="headline">'; html += data[0]['tittel']; html +='</h2>'; html +='</div>'; html +='</div>'; html +='</a>'; html +='</article>'; html +='<div class="'+tag+'_plustwo" style="width:100%;margin-top:8px;">'; html +='</div>'; html +='<div class="more" style="width:100%;text-align:center;margin-top:10px;margin-left:10px;height:32px;"><a style="text-decoration:none;width:calc(50% - 15px);float:left;" href="http://www.gd.no/debatt"><div style="background-color:#333333;color:#ffffff;padding:3px;border-radius:3px;">Mer</div></a>'; html +='<a style="float:left;width:calc(50% - 15px);text-decoration:none" href="http://www.gd.no/vis/skrivinnlegg/"><div style="background-color:#ffffff;color:#333333;padding:3px;border-radius:3px;">Skriv innlegg</div></a>'; html +='</div>'; html +='</div>'; html +='</div>'; html +='</div>'; html +='</section>'; return html; } function fillMobileTriple(data,nr){ var html =''; html += '<div style="width:100%;height:65px;margin-bottom:8px;background-color:#ffffff;">'; html += '<img src="'; html += data[nr]['bildeadresse']; html += '" style="float:left;height:65px;">'; html += '<div style="padding:5px;height:65px;float:left;font-weight:bold;width:250px;overflow:hidden;"><span style="color:#e9d14f;font-size:.875rem;font-weight:bold;text-transform:uppercase;">'+data[nr]['vignett']+'</span><br><a style="text-decoration:none;font-family:gsb;" href="'; html += data[nr]['adresse']; html += '">'; html += data[nr]['tittel']; html += '</a></div><div style="padding:5px;height:65px;float:right;">'; html += ''; html += '</div>'; html += '</div>'; return html; } function addmobileclicks(){ $.getJSON("//data.gd.no/data/analytics/linkpulse/retrieval.php?t=mfront&r=15min&m=a", function(linkpulse){ console.log(linkpulse); for (var ii = 0; ii < linkpulse.data.length; ii++){ var clicks = linkpulse.data[ii].attributes.clicks; if (clicks > 20){ var bg = 'green'; var font = 'white'; } else if (clicks > 10){ var bg = 'yellow'; var font = 'black'; } else { var bg = 'red'; var font = 'white'; } var position = linkpulse.data[ii].id.split("_pos"); var row = 'lp_'+position[0].replace('main_',''); var pos = 'lp_pos'+position[1]; console.log(row+':'+pos); var height = $('main .'+row+' .'+pos+' figure .am-figure-img').outerHeight(); console.log(height); if(height == null){ height = $('main .'+row+' article.'+pos).outerHeight(); $('main .'+row+' article.'+pos).after('<div style="position:absolute;top:0px;opacity:0.85;width:calc(100% - 20px);height:'+height+'px;background-color:'+bg+';line-height:30px;padding-left:10px;color:'+font+';" class="klikkblokk">Klikk <span class="klikktall" style="font-weight:bold;">'+linkpulse.data[ii].attributes.clicks+'</span></div>'); } else { $('main .'+row+' .'+pos+' figure .am-figure-img').after('<div style="position:absolute;top:0px;opacity:0.85;width:100%;height:'+height+'px;background-color:'+bg+';line-height:30px;padding-left:10px;color:'+font+';" class="klikkblokk">Klikk <span class="klikktall" style="font-weight:bold;">'+linkpulse.data[ii].attributes.clicks+'</span></div>'); } } }); } function updateclicks(){ $.getJSON("//data.gd.no/data/analytics/linkpulse/retrieval.php?t=dfront&r=15min&m=a", function(linkpulse){ console.log(linkpulse); for (var ii = 0; ii < linkpulse.data.length; ii++){ var clicks = linkpulse.data[ii].attributes.clicks; if (clicks > 20){ var bg = 'green'; var font = 'white'; } else if (clicks > 10){ var bg = 'yellow'; var font = 'black'; } else { var bg = 'red'; var font = 'white'; } var position = linkpulse.data[ii].id.split("_pos"); var row = 'lp_'+position[0].replace('main_',''); var pos = 'lp_pos'+position[1]; console.log(row+':'+pos); var height = $('main .'+row+' .'+pos+' figure .am-figure-img').outerHeight(); console.log(height); if(typeof height == 'undefined'){ console.log(row+':'+pos+' =bad'); } $('main .'+row+' .'+pos+' figure .am-figure-img').next('.klikkblokk').replaceWith('<div style="position:absolute;top:0px;opacity:0.85;width:100%;height:'+height+'px;background-color:'+bg+';line-height:30px;padding-left:10px;color:'+font+';" class="klikkblokk">Klikk <span class="klikktall" style="font-weight:bold;">'+linkpulse.data[ii].attributes.clicks+'</span></div>'); } }); } function findlinkpulse(){ var row_2 = $('.lp_row2').html(); if (row_2.length > 0){ addmobileclicks(); linkpulsefinderstopper(); } } function linkpulsefinderstopper() { clearInterval(linkpulsefinder); } if(window.location.hash == '#klikk'){ var banner = '<div style="position:fixed;display:block;z-index:9999999;width:100%;height:40px;background-color:#333333;line-height:40px;color:#ffffff;text-align:center;font-weight:bold;">Viser klikk siste 15 minutter</div>' $('body').prepend(banner); var linkpulsefinder = setInterval(function(){ findlinkpulse(); }, 1000); } </script>
<iframe width="100%" src="/vis/lesernes/bilder/embeds/collections/27672025" scrolling="no" height="442" frameborder="0"></iframe>