CINXE.COM

Svenska Dagbladet - Uppslagsverk - NE.se

<!DOCTYPE html> <html lang="sv" xml:lang="sv" tenant="ne"> <head> <title>Svenska Dagbladet - Uppslagsverk - NE.se</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="//cloud.typography.com/7584252/7846992/css/fonts.css"> <link rel="stylesheet" href="https://use.typekit.net/wif7hrv.css"> <!--[if !IE]><!--> <link rel="stylesheet" type="text/css" href="//masala-ux.ne.se/masala-ux/current/dist/css/masala-ux.min.css"> <link rel="stylesheet" type="text/css" href="//masala-ux.ne.se/masala-ux/current/dist/fonts/fontawesome/css/all-prefixed.css"> <!--<![endif]--> <!--[if lte IE 9]> <link rel="stylesheet" type="text/css" href="//masala-ux.ne.se/masala-ux/current/dist/css/masala-ux.split.min.css"> <link rel="stylesheet" type="text/css" href="//masala-ux.ne.se/masala-ux/current/dist/css/ie9.min.css"> <![endif]--> <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"/> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"/> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"/> <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"/> <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"/> <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"/> <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"/> <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"/> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"/> <link rel="icon" type="image/png" href="/favicon-192x192.png" sizes="192x192"/> <link rel="icon" type="image/png" href="/favicon-160x160.png" sizes="160x160"/> <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96"/> <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"/> <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"/> <meta name="msapplication-TileColor" content="#2d89ef"/> <meta name="msapplication-TileImage" content="/mstile-144x144.png"/> <meta name="msapplication-TileColor" content="#2d89ef"> <meta name="msapplication-TileImage" content="/mstile-144x144.png"> <!--[if lt IE 9]> <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <script> ; // Workaround to fix a FOUC bug in Firefox when using autofocus. See: https://bugzilla.mozilla.org/show_bug.cgi?id=712130 </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//masala-ux.ne.se/masala-ux/current/dist/fonts/import.min.css"> <style> #chatbox { max-width: 500px; min-width: 320px; width: 100%; border: 1px solid #ccc; position: fixed; bottom: 0; left: 0; background-color: #fff; display: flex; flex-direction: column; z-index: 1000; height: 600px; /* Set a fixed height for the entire chatbox */ } #chat-header { background-color: #f5f5f5; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; } #chat-header h3 { margin: 0; font-size: 16px; } #chat-header button, #assistant-info-popup button { background: none; border: none; font-size: 16px; cursor: pointer; } #title-section { display: flex; align-items: center; } #title-section .fa { font-size: 14px; vertical-align: text-top; } #chat-messages { flex: 1; padding: 10px 16px; overflow-y: auto; background-color: #f9f9f9; display: flex; flex-direction: column; } /* Ensure messages stack from top to bottom */ #chat-messages .message { flex-shrink: 0; margin-bottom: 16px; } #chat-input { display: flex; padding: 12px; background-color: #f5f5f5; } #message-input { flex: 1; padding: 5px; border: 1px solid #ccc; border-radius: 4px; } #message-input:focus { outline: none; } #send-button { padding: 5px 10px; margin-left: 10px; background-color: #18bdd4; border: none; color: #fff; border-radius: 4px; cursor: pointer; } #send-button:hover { background-color: #1394a6; } #send-button:disabled { background-color: #167784; } .message { margin-bottom: 16px; padding: 12px; border-radius: 4px; max-width: 80%; min-width: 100px; } .message.user { background-color: #18bdd4; color: #fff; align-self: flex-end; } .message.ai { background-color: #e9ecef; color: #000; align-self: flex-start; text-align: left; } .message p { margin-bottom: 0; } .author-label { font-size: 12px; } #typing-indicator { display: flex; align-items: center; font-style: italic; color: #555; margin-top: auto; /* Pushes the typing indicator to the bottom */ margin-bottom: 10px; } /* Animated Dots */ @keyframes blink { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } } #typing-dots { display: inline-block; margin-left: 5px; } #typing-dots span { opacity: 0; animation: blink 1s infinite; } #typing-dots span:nth-child(2) { animation-delay: 0.2s; } #typing-dots span:nth-child(3) { animation-delay: 0.4s; } #disabled-chat-button { cursor: not-allowed; color: #c7c7c7; } #assistant-info-popup { position: fixed; min-width: 600px; top: 50%; left: 50%; padding: 20px; display: flex; flex-direction: column; transform: translate(-50%, -50%); background-color: #fff; border: 1px solid #ccc; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .popup-header { display: flex; justify-content: space-between; align-items: center; } .popup-header h2 { font-size: 1.5em; margin: 0; } .close-btn { font-size: 1.2em; background: none; border: none; cursor: pointer; } .divider { margin: 15px 0; border: none; border-top: 1px solid #ddd; } .popup-content { display: flex; gap: 20px; } .section { flex: 1; } .section h3 { font-size: 1.1em; font-weight: bold; margin: 0 0 10px; display: flex; align-items: center; } .section .fa { margin-right: 8px; font-size: 24px; } .section .fa.fa-comment { color: #18bdd4; } .section .fa.fa-info-circle { color: #09550F; } .icon { font-size: 1.3em; margin-right: 8px; } .section ul { list-style-type: disc; padding-left: 24px; margin: 0; } .section ul li { margin-bottom: 8px; } .learn-more-link { display: inline-block; margin-top: 15px; font-size: 0.9em; color: #007bff; text-decoration: none; } #retry-button { margin-top: 10px; background-color: #18bdd4; color: #fff; padding: 5px 10px; border: none; cursor: pointer; border-radius: 4px; } </style> <script> // remove fromSearch getParameter if (window.location.search.indexOf("fromSearch=true") > 0) { var url = window.location.href.replace(/[?&]fromSearch=true/,""); history.replaceState(null, null, url); } </script> </head> <body class="encyklopedia scrollup" id="articleView"> <!-- Google Tag Manager --> <noscript> <iframe src="//www.googletagmanager.com/ns.html?id=GTM-KRK9SR" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> <script>(function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-KRK9SR');</script> <!-- End Google Tag Manager --> <header role="banner" style="" > <nav class="navigation"> <div class="container"> <div class="row"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".js-navigation-collapsed" aria-expanded="false"> <span class="sr-only">Visa navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="/uppslagsverk/login" class="btn btn-primary navbar-btn-mobile">Logga in</a> <a class="navbar-logo" href="/" title="Återgå till startsidan för NE.se"> <h1 class="sr-only">NE.se</h1> <i class="icon-ne-logo"></i> </a> </div> <div class="collapse navbar-collapse js-navigation-collapsed"> <ul class="nav navbar-nav"> <li> <a href="/info/skolor">Skolor</a></li> <li> <a href="/info/bibliotek">Bibliotek</a> </li> <li> <a href="/info/företag">Företag</a> </li> <li> <a href="/info/myndigheter">Myndigheter</a> </li> <li> <a href="/info/privat">Privat</a> </li> </ul> <div class="navbar-right"> <ul class="nav navbar-nav"> <li><a class="mr-sm" href="/info/kontakt/"> Kontakta oss </a></li> </ul> <a href="/uppslagsverk/login" class="btn btn-primary navbar-btn hidden-xs"> Logga in </a> </div> </div> </div> </div> </nav> </header> <nav class="navigation-slim init-navigation-slim" id="navigation-slim"> <div class="navigation-slim-inner"> <ul class="navigation-breadcrumbs has-search"> <li>Uppslagsverket</li> <li>Svenska Dagbladet</li> </ul> </div> </nav> <main> <section class="banner light border-bottom"> <div class="container"> <div class="row"> <div class="search-container"> <div class="search-heading"> <h2><a href="/uppslagsverk/">Uppslagsverket</a></h2> </div> <div class="search-input"> <div class="searchbar searchbar-authenticated" role="search" data-component="searchbar-static" data-activesearch-url="/sök/aktiv/"> <form id="search" action="/sök/" > <div class="form-group"> <div class="input-group"> <div class="input-group-btn sources"> <label class="btn dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"> <span class="selected-source"> Uppslagsverk </span> <i class="fa fa-fw fa-caret-down"></i> </label> <ul class="dropdown-menu"> <li role="presentation" class="dropdown-header">SÖKKÄLLOR</li> <div class="btn-group-vertical" data-toggle="buttons"> <label class="btn btn-link text-left active"> <input type="radio" name="t" value="uppslagsverk" checked> Uppslagsverk </label> <label class="btn btn-link text-left "> <input type="radio" name="t" value="enzy" > Enzyklopädie </label> <label class="btn btn-link text-left "> <input type="radio" name="t" value="illustrationer" > Uppslagsverk </label> <label class="btn btn-link text-left "> <input type="radio" name="t" value="kartor" > Uppslagsverk </label> </div> </ul> </div> <label for="q" class="sr-only">Sök</label> <input type="text" name="q" id="q" class="form-control input-lg typeahead" autocomplete="off" placeholder="Sök i uppslagsverket ..." value=""> <div class="input-group-btn"> <button class="btn btn-lg" type="submit" title="Sök"> <i class="fa fa-search"></i><span class="sr-only">Sök</span> </button> </div> </div> </div> </form> </div> </div> </div> </div> </div> </section> <div class="container"> <div class="row"> <article class="article"> <header class="page-header"> <h1> <span>Svenska Dagbladet</span> </h1> </header> <p><span class="huvud"><span class="uppslag">Svenska Dagbladet,</span> <i>SvD</i>, </span><span class="def">obunden moderat daglig morgontidning, utgiven i Stockholm.</span> Aktiemajoriteten i SvD, som 1994 förvärvades av företag i Wallenberggruppen, köptes 1998 av det norska medieföretaget Schibsted.</p> <p>SvD grundades 1884 som ett organ för unionsfientliga och tullvänliga krafter. Efter några såväl publicistiskt som ekonomiskt stormiga år rekonstruerades SvD 1897. Genom ekonomiskt stöd från mecenaten Ernest Thiel ställdes SvD till de s.k. nittiotalisternas förfogande och omvandlades till ett, med Verner von Heidenstams ord, ”intelligensblad”, med i första hand kulturell</p><span class="limited-document">(78 av 552 ord)</span> <section id="promotion" class="promotion-container mt-sm mb-md"> <div class="pitch"> Vill du få tillgång till hela artikeln? </div> <div class="actions"> <a id="skaffane1" class="btn btn-primary" href="/info/privat">Testa NE.se gratis</a> <span class="ml-xs mr-xs">eller</span> <a href="/uppslagsverk/login">Logga in</a> </div> </section> <ul class="list-grouped list-grouped-authors hidden"> <li class="list-grouped-header">Författare:</li> <li>Elisabeth Sandlund</li> </ul> <hr> <div class="article-info-expand mb-sm mt-sm"> <h4 class="mr-xs"> <i class="fa fa-info-circle mr-xs"></i> Information om artikeln <a data-toggle="collapse" class="btn btn-info btn-sm article-info-toggle ml-xs collapsed" href="#collapse-article-info"> <i class="fa fa-chevron-circle-down mr-xs"></i> <span class="article-info-span show-text">Visa</span> <span class="article-info-span hide-text">Stäng</span> </a> </h4> </div> <div id="collapse-article-info" class="collapse"> <h4 class="h4 mt-sm"> Medverkande </h4> <ul class="list-grouped list-grouped-authors"> <li>Elisabeth Sandlund</li> </ul> <section class="section"> <header> <h4 class="h4"> Litteraturanvisning </h4> </header> <div class="littref"><span class="forf">Ivar Anderson (utgivare)</span>, <span class="titel">Svenska Dagbladets historia</span> 1–2 (<span class="datum">1960–65</span>);</div><div class="littref"><span class="forf">Ragnar Anderson</span>, <span class="titel">Svenska Dagbladet och det politiska livet 1897–1918</span> (<span class="datum">1952</span>);</div><div class="littref"><span class="forf">T. Höjer, </span><span class="titel">Svenska Dagbladet och det andra världskriget</span> (<span class="datum">1969</span>);</div><div class="littref"><span class="forf">E. Sandlund (utgivare)</span>, <span class="titel">Svenska Dagbladets historia</span> 3 (<span class="datum">1984</span>).</div> </section> <section class="section"> <div class="source-reference-title">Källangivelse</div> <div class="reference" id="source-reference"> <span class="reference-source">Nationalencyklopedin,</span> <span class="reference-article">Svenska Dagbladet.</span> <span class="reference-url">http://www.ne.se/uppslagsverk/encyklopedi/lång/svenska-dagbladet</span> <time class="reference-date" datetime="2024-12-01">(hämtad 2024-12-01)</time> </div> </section> </div> </article> <aside class="article-toc"> <nav class="toc"> </nav> </aside> <aside class="article-aside complementary"> <div class="panel-group mb-none"> <div class="panel article-aside-tools"> <div id="tools" class="panel-collapse collapse in"> <div class="tool"> <a href="javascript:window.print()" role="button"> <i class="fa fa-print"></i>&emsp;Skriv ut artikel </a> </div> <div class="tool"> <a href="javascript:launchImmersiveReader('sv-SE')" role="button"> <svg style="fill:#737373; height:auto; width: 16px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M560.51 225.9L528.75 98.64C522.05 71.78 495.01 32 443.33 32c-15.63 0-23.03 2.94-43.02 9.6-8.39 2.79-12.92 11.86-10.12 20.24l5.06 15.18c2.24 6.7 8.48 10.94 15.18 10.94 3.54 0 4.82-.74 18.23-5.21 26.07-8.68 48.2 6.13 53.53 27.54l29.67 118.68C490.97 215.88 466.47 208 440 208c-55.09 0-102.27 32.91-123.65 80h-56.7c-21.38-47.09-68.56-80-123.65-80-26.47 0-50.97 7.88-71.86 20.96l29.67-118.68c5.32-21.41 27.46-36.22 53.53-27.54 13.42 4.47 14.7 5.21 18.23 5.21 6.7 0 12.94-4.24 15.18-10.94l5.06-15.18c2.8-8.38-1.73-17.45-10.12-20.24C155.7 34.94 148.3 32 132.67 32 81 32 53.95 71.78 47.25 98.64L15.49 225.9C2.16 279.34 0 300.12 0 344c0 75.11 60.89 136 136 136 72.37 0 130.97-56.69 135.19-128h33.61c4.22 71.31 62.82 128 135.19 128 75.11 0 136-60.89 136-136 .01-43.88-2.15-64.66-15.48-118.1zM136 416c-39.7 0-72-32.3-72-72s32.3-72 72-72 72 32.3 72 72-32.3 72-72 72zm304 0c-39.7 0-72-32.3-72-72s32.3-72 72-72 72 32.3 72 72-32.3 72-72 72z"/></svg>&emsp;Läshjälp </a> </div> </div> </div> <nav class="panel article-aside-related" role="navigation"> <h3>Läs även om</h3> <div id="related" class=""> <div class="panel-body pt-none"> <ul> <li><a href="/uppslagsverk/encyklopedi/lång/torsten-kreuger">Torsten Kreuger</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/helmer-key">Helmer Key</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/stockholms-tidningen">Stockholms-Tidningen</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/ivar-kreuger">Ivar Kreuger</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/otto-järte">Otto Järte</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/sf-studios">SF Studios</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/fredrik-böök">Fredrik Böök</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/sydsvenskan">Sydsvenskan</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/allan-hernelius">Allan Hernelius</a></li> <li><a href="/uppslagsverk/encyklopedi/lång/stockholms-dagblad">Stockholms Dagblad</a></li> </ul> </div> </div> </nav> </div> </aside> </div> </div> </main> <div id="permalinkModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Permalink</h4> </div> <div class="modal-body"> <h3><i class="fa fa-spinner fa-spin"></i> Skapar permalink, var god vänta!</h3> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Stäng</button> </div> </div> </div> </div> <div id="citationModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">???i18n.citation.modal.title???</h4> </div> <div class="modal-body"> <h3><i class="fa fa-spinner fa-spin"></i> Skapar permalink, var god vänta!</h3> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">???i18n.citation.modal.close???</button> </div> </div> </div> </div> <footer class="page-footer" role="contentinfo"> <style> .footer-container { align-items: center; display: flex; flex-direction: column; margin: 20px 0; row-gap: 20px; } @media (min-width: 660px) { .footer-container { flex-direction: row; } } </style> <div style="background: #fff; border-top: 1px solid rgba(0, 0, 0, 0.12); color: rgb(51, 51, 51);"> <div class="container"> <div class="footer-container"> <div style=" display: flex; align-items: center; column-gap: 10px; flex-grow: 1; " > <a href="/" ><h1 style=" border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; " ></h1> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 456 327" style="height: 37px; width: 52px" aria-label="Home Page" > <path d="M0 0v327h456V0H0zm447 320H9V7h438v313z"></path> <path d="M436 20H20v287h416V20zm-46.746 251h-141.7l-137.52-167.601c-.642-1.929-2.568-.905-3.212-.261l-.322 142.047c.644 7.711 6.746 16.469 13.818 19.681 3.854 1.287 7.068 3.134 10.282 3.134H72.12c9.639-4 10.924-14.767 14.78-23.763l-.082-167.394C84.248 64.63 72.12 57.349 61.195 53.495L60.552 52h54.622l132.379 164.887 1.287-1.421-.16-134.615c0-12.211-12.691-22.661-22.973-27.158L227.634 52H377v43.804c-2-9.638-8.621-19.276-18.259-24.417C352.714 66.726 282 68.172 282 68.172V142h76.086c7.07-2 13.412-9.441 17.914-13.941 0 0 .079 31.154.079 46.577C371.58 168.852 364.51 160 356.16 160H282v90.274c32-.639 64.509 4.901 92.785-4.094 10.926-5.782 14.784-16.828 19.284-26.47.643 16.067-2.886 33.29-4.815 51.29z" ></path></svg ></a> <div>&copy;2023 NE Nationalencyklopedin AB</div> </div> <div style="display: flex; align-items: center; column-gap: 20px"> <a href="https://www.ne.se/info/skola/">Om tjänsten</a> <a href="https://faq.ne.se/">Frågor och svar</a> <a href="https://www.ne.se/info/kontaktsida/">Kontakta oss</a> </div> </div> </div> </div> </footer> <div class="modal fade" id="noTigtagAccessModal" role="dialog"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4>Tigtag</h4> <div>För att använda tjänsten Tigtag måste du vara inloggad med ett personligt konto.</div> </div> <div class="modal-body"> <a href="/login" class="btn btn-primary btn-block">Logga in med personligt konto</a> <div class="mt-xs mb-xs text-center">eller</div> <a href="/account/create?signup=nese" class="btn btn-default btn-block">Skapa personligt konto</a> </div> <div class="modal-footer"> <button type="submit" class="btn btn-disabled pull-left" data-dismiss="modal">Avbryt</button> </div> </div> </div> </div> <script>window.jQuery || document.write('<script src="//masala-ux.ne.se/masala-ux/current/dist/js/jquery.min.js"><\/script>')</script> <script src="/content/core/index/scripts/footerScripts.js"></script> <script src="//masala-ux.ne.se/masala-ux/current/dist/js/jwplayer.js"></script> <script src="//masala-ux.ne.se/masala-ux/current/dist/js/masala-ux.min.js"></script> <script> if(document.getElementById("navigation-pusher") != null) { document.getElementById("navigation-pusher").style.height = "80px"; } </script> <script src="//masala-ux.ne.se/masala-ux/current/dist/js/clipboard.min.js"></script> <script src="/uppslagsverk/assets/js/encyklopedia-web.js"></script> <script src="/uppslagsverk/assets/js/immersive-reader-sdk-1.1.0.js"></script> <script src="/uppslagsverk/assets/js/immersive-reader.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> var path = "/encyklopedi/lång/svenska-dagbladet"; var subType = "lång"; var type = "encyklopedi"; $(document).ready(function() { let threadId = null; let isLoading = false; let lastUserMessage = null; const inputField = $('#message-input'); const sendButton = $('#send-button'); $('#send-button').on('click', sendMessage); $('#message-input').on('keypress', function(e) { if (e.key === 'Enter') { sendMessage(); } }); $('#close-chat').on('click', function() { resetChat(); $('#chatbox').hide(); }); function resetChat(clearThread = true) { if (clearThread) { $('#chat-messages').children('.message').not('#ai-setup-indicator, #typing-indicator').remove(); threadId = null; } $('#error-message').hide(); showAISetupIndicator(); } function appendMessage(content, sender) { const messageContainer = $('<div>').addClass('message').addClass(sender); const label = sender === 'ai' ? 'AI-Martin' : 'Du'; const formattedContent = sender === 'ai' ? content.replace(/\n/g, '<br>') : $('<div>').text(content).html().replace(/\n/g, '<br>'); messageContainer.html(formattedContent + ' <p class="author-label">' + label + '</p>'); $('#chat-messages').append(messageContainer); $('#typing-indicator').before(messageContainer); scrollChatToBottom(); } function showAISetupIndicator() { $('#ai-setup-indicator').show(); scrollChatToBottom(); } function hideAISetupIndicator() { $('#ai-setup-indicator').hide(); } function showTypingIndicator() { $('#typing-indicator').show(); scrollChatToBottom(); } function hideTypingIndicator() { $('#typing-indicator').hide(); } function scrollChatToBottom() { const chatMessages = $('#chat-messages'); chatMessages.scrollTop(chatMessages[0].scrollHeight); } function displayErrorMessage() { const isThreadInitialized = threadId !== null; const buttonLabel = isThreadInitialized ? 'Skicka igen' : 'Starta om'; $('#retry-button').text(buttonLabel).show(); $('#error-message').show(); $('#retry-button').off('click').on('click', function() { $('#error-message').hide(); if (isThreadInitialized) { retryLastMessage(); } else { setupAIAssistant(); } }); } function setupAIAssistant() { resetChat(false); inputField.prop('disabled', true); sendButton.prop('disabled', true); inputField.val(''); $('#error-message').hide(); isLoading = true; showAISetupIndicator(); $.ajax({ type: 'POST', url: '/uppslagsverk/api/v1/gpt/threads', contentType: 'application/json; charset=UTF-8', data: JSON.stringify({ articleExcerpt: "", path: path, subType: subType, type: type, }), success: function(response) { isLoading = false; threadId = response.id; hideAISetupIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); appendMessage(response.content, 'ai'); }, error: function() { isLoading = false; hideAISetupIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); displayErrorMessage(); } }); } function sendMessage() { $('#error-message').hide(); const message = inputField.val().trim(); if (message === '') return; lastUserMessage = message; appendMessage(message, 'user'); inputField.val(''); isLoading = true; showTypingIndicator(); inputField.prop('disabled', true); sendButton.prop('disabled', true); if (!threadId) { setupAIAssistant(); } else { $.ajax({ type: 'POST', url: '/uppslagsverk/api/v1/gpt/messages', contentType: 'application/json; charset=UTF-8', data: JSON.stringify({ content: message, threadId: threadId }), success: function(response) { isLoading = false; hideTypingIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); appendMessage(response.content, 'ai'); }, error: function() { isLoading = false; hideTypingIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); displayErrorMessage(); } }); } } function retryLastMessage() { if (!lastUserMessage) return; appendMessage(lastUserMessage, 'user'); isLoading = true; showTypingIndicator(); inputField.prop('disabled', true); sendButton.prop('disabled', true); ajaxRequest = $.ajax({ type: 'POST', url: '/uppslagsverk/api/v1/gpt/messages', contentType: 'application/json; charset=UTF-8', data: JSON.stringify({ content: lastUserMessage, threadId: threadId }), success: function(response) { isLoading = false; hideTypingIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); appendMessage(response.content, 'ai'); }, error: function() { isLoading = false; hideTypingIndicator(); inputField.prop('disabled', false); sendButton.prop('disabled', false); displayErrorMessage(); } }); } $(document).on('click', '.start-chat-button', function(e) { e.preventDefault(); $('#chatbox').show(); setupAIAssistant(); }); $('#show-assistant-info').on('click', function() { $('#assistant-info-popup').show(); }); $('#close-assistant-info').on('click', function() { $('#assistant-info-popup').hide(); }); $('#close-popup').on('click', function() { $('#help-popup').hide(); }); }); </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10