MakerCollider/node-red-contrib-smartnode-hook · highcharts-more.src.js
javascript logo
function (config) {
				var backgroundColor = config.backgroundColor,  // if defined, replace the old one (specific for gradients)
					axisUserOptions = firstAxis.userOptions;
				config = merge(pane.defaultBackgroundOptions, config);
				if (backgroundColor) {
					config.backgroundColor = backgroundColor;
				}
				config.color = config.backgroundColor; // due to naming in plotBands
				firstAxis.options.plotBands.unshift(config);
				axisUserOptions.plotBands = axisUserOptions.plotBands || []; // #3176
				axisUserOptions.plotBands.unshift(config);
			}
Similar code snippets
1.
mojaie/kiwiii-client · Dialog.js
Match rating: 39.01% · See similar code snippets
javascript logo
function importColDialog(tbl, callback) {
  d3.select('#importcol-file')
    .on('change', () => {
      const file = document.getElementById('importcol-file').files[0];
      const isCsv = file.name.split('.').pop() === 'csv';
      hfile.readFile(file).then(res => {
        const mapping = isCsv ? dstr.csvToMapping(res) : JSON.parse(res);
        const tbl = dstr.columnMappingToTable(mapping);
        d3.select('#importcol-preview').call(cmp.createTable, tbl)
          .call(cmp.updateTableRecords,
                tbl.records.slice(0, 5), d => d[tbl.columns[0].key]);
        // bind mapping
        d3.select('#importcol-preview').datum(mapping);
      });
    });
  d3.select('#importcol-submit')
    .on('click', () => {
      let mapping = d3.select('#importcol-preview').datum();
      d3.select('#importcol-preview').datum(null);  // unbind mapping
      // Generate thumbnails
      const plotCols = [];
      if (mapping.hasOwnProperty('column')) {
        mapping = dstr.singleToMultiMapping(mapping);
      }
      mapping.columns.forEach((e, i) => {
        if (e.valueType === 'plot') {
          mapping.columns[i].valueType = 'image';
          plotCols.push(i);
        }
      });
      if (plotCols.length > 0) {
        const ps = [];
        Object.entries(mapping.mapping).forEach(m => {
          plotCols.forEach(e => {
            const p = himg.plotThumbnail(m[1][e])
              .then(img => {
                mapping.mapping[m[0]][e] = img;
              });
            ps.push(p);
          });
        });
        Promise.all(ps).then(() => callback([mapping]));
      } else {
        callback([mapping]);
      }
    });
}
2.
Tamersoul/magic-wand-js · OpenLayers.debug.js
Match rating: 38.68% · See similar code snippets
javascript logo
function(theDiv, newColor) {
   
        theDiv.style.backgroundColor = newColor;

        var spanElements = theDiv.parentNode.getElementsByTagName("span");
        
        for (var currIdx = 0; currIdx < spanElements.length; currIdx++) {
            spanElements[currIdx].style.backgroundColor = newColor;
        }
    }
3.
iuap-design/tinper-neoui-grid · u-tree.js
Match rating: 37.85% · See similar code snippets
javascript logo
function(targetNode, node, moveType, isSilent) {
			if (!node) return null;
			if (targetNode && !targetNode.isParent && this.setting.data.keep.leaf && moveType === consts.move.TYPE_INNER) return null;
			var _this = this,
				newNode = tools.clone(node);
			if (!targetNode) {
				targetNode = null;
				moveType = consts.move.TYPE_INNER;
			}
			if (moveType == consts.move.TYPE_INNER) {
				function copyCallback() {
					view.addNodes(_this.setting, targetNode, [newNode], isSilent);
				}

				if (tools.canAsync(this.setting, targetNode)) {
					view.asyncNode(this.setting, targetNode, isSilent, copyCallback);
				} else {
					copyCallback();
				}
			} else {
				view.addNodes(this.setting, targetNode.parentNode, [newNode], isSilent);
				view.moveNode(this.setting, targetNode, newNode, moveType, false, isSilent);
			}
			return newNode;
		}
4.
Kolbaskin/yode-server · form_utils.js
Match rating: 37.43% · See similar code snippets
javascript logo
function updateColor(img_id, form_element_id) {
	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
}
5.
sdelements/lets-chat · user-collection.js
Match rating: 37.41% · See similar code snippets
javascript logo
function(user) {
    user = typeof user.toJSON === 'function' ? user.toJSON() : user;
    var userId = typeof user === 'object' ? user.id.toString() : user;
    delete this.users[userId];
}
6.
googlearchive/node-big-rig · attribute.js
Match rating: 37.21% · See similar code snippets
javascript logo
function(mergedAttribute,
                                                    opt_model) {
    if (mergedAttribute.constructor !== this.constructor) {
      if (opt_model) {
        opt_model.importWarning({
          type: 'attribute_parse_error',
          message: 'Attribute with different types: ' + this.constructor +
              ' and ' + mergedAttribute.constructor + '.'
        });
      }
    } else if (mergedAttribute.units !== this.units) {
      if (opt_model) {
        opt_model.importWarning({
          type: 'attribute_parse_error',
          message: 'Attribute with different units: ' + this.units +
              ' and ' + mergedAttribute.units + '.'
        });
      }
    }
  }
7.
Kolbaskin/yode-server · tiny_mce_src.js
Match rating: 36.67% · See similar code snippets
javascript logo
function renderBlockOnIE(block) {
				var oldRng;

				if (tinymce.isIE && dom.isBlock(block)) {
					oldRng = selection.getRng();
					block.appendChild(dom.create('span', null, '\u00a0'));
					selection.select(block);
					block.lastChild.outerHTML = '';
					selection.setRng(oldRng);
				}
			}
8.
JohanObrink/simple-pg · pg.js
Match rating: 36.47% · See similar code snippets
javascript logo
function upsert (table, idcol, data) {
  const {sql, params} = sqlbuilder.upsert(table, idcol, data)
  return this.query(sql, params)
}
9.
danvk/dygraphs · axes.js
Match rating: 36.44% · See similar code snippets
javascript logo
function(e) {
  var g = e.dygraph;

  if (g.getOptionForAxis('drawAxis', 'y')) {
    var w = g.getOptionForAxis('axisLabelWidth', 'y') + 2 * g.getOptionForAxis('axisTickSize', 'y');
    e.reserveSpaceLeft(w);
  }

  if (g.getOptionForAxis('drawAxis', 'x')) {
    var h;
    // NOTE: I think this is probably broken now, since g.getOption() now
    // hits the dictionary. (That is, g.getOption('xAxisHeight') now always
    // has a value.)
    if (g.getOption('xAxisHeight')) {
      h = g.getOption('xAxisHeight');
    } else {
      h = g.getOptionForAxis('axisLabelFontSize', 'x') + 2 * g.getOptionForAxis('axisTickSize', 'x');
    }
    e.reserveSpaceBottom(h);
  }

  if (g.numAxes() == 2) {
    if (g.getOptionForAxis('drawAxis', 'y2')) {
      var w = g.getOptionForAxis('axisLabelWidth', 'y2') + 2 * g.getOptionForAxis('axisTickSize', 'y2');
      e.reserveSpaceRight(w);
    }
  } else if (g.numAxes() > 2) {
    g.error('Only two y-axes are supported at this time. (Trying ' +
            'to use ' + g.numAxes() + ')');
  }
}
10.
webdesserts/alchemist-js · color.js
Match rating: 36.33% · See similar code snippets
javascript logo
function to (target_name, options) {
  options = options || {}
  var color = this.as(target_name)
  if (options.precision === null) return color.val;
  else return color.round(options.precision)
}