{"id":235,"date":"2024-01-21T22:05:38","date_gmt":"2024-01-21T21:05:38","guid":{"rendered":"https:\/\/www.tuwort.com\/?page_id=235"},"modified":"2024-01-21T22:18:19","modified_gmt":"2024-01-21T21:18:19","slug":"tuwort-und-unverb-des-jahres-2023","status":"publish","type":"page","link":"https:\/\/www.tuwort.com\/index.php\/tuwort-und-unverb-des-jahres-2023\/","title":{"rendered":"tuwort und Unverb des Jahres 2023"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Diskussion der Kandidaten: <a href=\"https:\/\/www.tuwort.com\/index.php\/2024\/01\/21\/tuwort-16\/\">https:\/\/www.tuwort.com\/index.php\/2024\/01\/21\/tuwort-16\/<\/a><\/p>\n\n\n        <div class=\"wp-sjs-plugin\" id=\"surveyContainer-2\">\n            <div id=\"surveyElement-2\">Survey is loading&#8230;<\/div>\n            <div id=\"surveyResult-2\"><\/div>\n        <\/div>\n        <script>\n            jQuery.ajax({\n                url:  \"https:\/\/www.tuwort.com\/wp-admin\/admin-ajax.php?action=SurveyJS_GetSurveyJson\",\n                type: \"POST\",\n                data: { Id: 2, _wpnonce: 'c745ee42e8' },\n                success: function (data) {\n                    var json = {}\n                    let theme;\n                    if (data.json) {\n                        json = JSON.parse(data.json.replace(\/\\\\\\\"\/g, \"\\\"\").replace(\/\\\\\\\\\/g, \"\\\\\").replace(\/\\\\'\/g, \"'\"));\n                    }\n                    if (data.theme) {\n                        theme = JSON.parse(data.theme.replace(\/\\\\\\\"\/g, \"\\\"\").replace(\/\\\\\\\\\/g, \"\\\\\").replace(\/\\\\'\/g, \"'\"));\n                    } else {\n                        theme = null\n                    }\n                    jQuery(document).ready(()=>{\n                        initSurvey2(json, theme);\n                    });\n                }\n            });\n\n            function initSurvey2(json, theme) {\n                const survey2 = new Survey.Model(json);\n                if (!!theme) {\n                    survey2.applyTheme(theme);\n                }\n                window.survey2 = survey2;               \n                survey2                    .onComplete\n                    .add(function (sender, options) {\n                        options.showSaveInProgress();\n                        jQuery.ajax({\n                            url:  \"https:\/\/www.tuwort.com\/wp-admin\/admin-ajax.php?action=SurveyJS_SaveResult\",\n                            type: \"POST\",\n                    data: { SurveyId: '2', Json : JSON.stringify(sender.data), _wpnonce: 'a4ff1ab33e' },\n                            success: function (data) {options.showSaveSuccess();},\n                            error: function (xhr) {options.showSaveError(xhr.responseText);}\n                        });\n                        \/\/document\n                        \/\/    .querySelector(\"#surveyResult-2\")\n                        \/\/    .innerHTML = \"result: \" + JSON.stringify(sender.data);\n                    });\n\n                survey2.onUploadFiles.add((_, options) => {\n                    const formData = new FormData();\n                    options.files.forEach((file) => {\n                        formData.append(file.name, file);\n                    });\n                formData.append(\"_wpnonce\", \"47b781cddc\");\n                formData.append(\"SurveyId\", \"2\");\n\n                    fetch(\"https:\/\/www.tuwort.com\/wp-admin\/admin-ajax.php?action=SurveyJS_UploadFiles\", {\n                        method: \"POST\",\n                        body: formData\n                    })\n                        .then((response) => response.json())\n                        .then((data) => {\n                            options.callback(\n                                options.files.map((file) => {\n                                    return {\n                                        file: file,\n                                        content: data[file.name]\n                                    };\n                                })\n                            );\n                        })\n                        .catch((error) => {\n                            console.error(\"Error: \", error);\n                            options.callback([], [ 'An error occurred during file upload.' ]);\n                        });\n                });\n\n                function deleteFile(fileURL, options) {\n                    try {\n                        const deleteFileBaseUrl = \"https:\/\/www.tuwort.com\/wp-admin\/admin-ajax.php?action=SurveyJS_DeleteFile&#038;_wpnonce=695047f952\";\n                        const apiUrl = `${deleteFileBaseUrl}&name=${encodeURIComponent(fileURL)}`;\n                        fetch(apiUrl);\n                    } catch (error) {\n                        options.callback(\"error\");\n                    }\n                }\n\n                survey2.onClearFiles.add((_, options) => {\n                    if (!options.value || options.value.length === 0) {\n                        options.callback(\"success\");\n                        return;\n                    }\n\n                    if (!options.fileName && !!options.value) {\n                        for (const item of options.value) {\n                            deleteFile(item.content, options);\n                        }\n                    } else {\n                        const fileToRemove = options.value.find(\n                            (item) => item.name === options.fileName\n                        );\n                        if (fileToRemove) {\n                            deleteFile(fileToRemove.content, options);\n                        } else {\n                            console.error(`File with name ${options.fileName} is not found`);\n                        }\n                    }\n                    options.callback(\"success\");\n                });\n\n                jQuery(\"#surveyElement-2\").Survey({model: survey2\/*, css: customCss*\/});\n            }\n        <\/script>        \n        ","protected":false},"excerpt":{"rendered":"<p>Diskussion der Kandidaten: https:\/\/www.tuwort.com\/index.php\/2024\/01\/21\/tuwort-16\/<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-235","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/pages\/235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/comments?post=235"}],"version-history":[{"count":2,"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/pages\/235\/revisions"}],"predecessor-version":[{"id":241,"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/pages\/235\/revisions\/241"}],"wp:attachment":[{"href":"https:\/\/www.tuwort.com\/index.php\/wp-json\/wp\/v2\/media?parent=235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}