PageSourceSearch

https://ronneby.se/download/18.40cd61cf160507e9844ae38/1513244131238/feedback-form-client.js

js ronneby.se collected 2026-10-02 07:05:18 UTC 1,979 bytes, 64 lines download raw bytes

1/* global
2      ga
3*/
4
5// Feedback form
6(function ($) {
7  var translations = {
8    defaultLanguage: 'sv',
9    sv: {
10      informativeContent: 'Hjälpte den här sidan dig?',
11      yes: 'Ja',
12      no: 'Nej',
13      or: 'eller',
14      close: 'Stäng'
15    },
16    en: {
17      informativeContent: 'Was this page helpful to you?',
18      yes: 'Yes',
19      no: 'No',
20      or: 'or',
21      close: 'Close'
22    }
23  };
24
25  function t(translationName) {
26    return translations[$('html').attr('lang')][translationName];
27  }
28
29  $.fn.feedbackForm = function () {
30    var feedbackFormIsSubmitted = !!location.search.match('state=create');
31
32    return this.each(function () {
33      var yesOrNoButtons = $('<button type="button" data-action="yes" class="litenxtext">' + t('yes') + '</button><button type="button" data-action="no" class="litenxtext">' + t('no') + '</button>');
34      var question = $('<div class="lp-feedback-form-question"><span class="litenxtext">' + t('informativeContent') + '</span></div>').append(yesOrNoButtons);
35      var closeButton = $('<input type="button" class="litenxtext lp-feedback-form-close-button" value="' + t('close') + '" />');
36      var form = $(this);
37      var formSubmitButton = form.find('input[type=submit]');
38
39      form.before(question).hide();
40      formSubmitButton.after(closeButton).after(' ' + t('or') + ' ');
41
42      // Workaround for Firefox bug 439810
43      yesOrNoButtons.attr('disabled', false);
44
45      if (feedbackFormIsSubmitted) {
46        yesOrNoButtons.attr('disabled', true);
47        form.show();
48        question.get(0).scrollIntoView();
49      }
50
51      yesOrNoButtons.click(function() {
52        var action = $(this).data('action');
53        yesOrNoButtons.attr('disabled', true);
54        form.slideDown();
55
56        ga('send', 'event', 'relevant_information', action);
57      });
58
59      closeButton.click(function () {
60        form.slideUp();
61      });
62    });
63  };
64}(jQuery));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.