File: colourWidget.js

package info (click to toggle)
r-cran-colourpicker 1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,620 kB
  • sloc: makefile: 13; sh: 3
file content (30 lines) | stat: -rw-r--r-- 580 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
HTMLWidgets.widget({

  name: 'colourWidget',

  type: 'output',

  factory: function(el, width, height) {

    var elementId = el.id;
    var container = $("#" + el.id);
    var initialized = false;

    return {

      renderValue: function(opts) {
        if (!initialized) {
          initialized = true;
          container.colourpicker({changeDelay : 0});
        }

        container.colourpicker("settings", opts);
        container.colourpicker("value", opts.value);
      },

      resize: function(width, height) {
      }

    };
  }
});