Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initialize() {
app.webChannel = webChannel;
app.me = new Me();
app.clipboard = new Clipboard('button');
app.experiments = new ExperimentsCollection();
app.pageManager = new PageManager({
pageContainer: document.querySelector('[data-hook=page-container]')
});
app.experiments.fetch().then(() => app.me.fetch()).then(() => {
app.me.updateEnabledExperiments(app.experiments);
app.startRouter();
}).catch((err) => {
console && console.error(err); // eslint-disable-line no-console
app.startRouter();
app.router.redirectTo('error');
});
},
setupClipboards() {
let clipboards = document.querySelectorAll( this.reportItemBtn );
// Create clipboard instance.
this.clipboardInstance = new Clipboard( clipboards, {
target: trigger => {
return trigger.lastElementChild;
}
});
// Clear selection after copy.
this.clipboardInstance.on( 'success', event => {
// Store current label.
let currentLabel = event.trigger.parentElement.getAttribute( 'aria-label' );
// Set copy success message.
event.trigger.parentElement.setAttribute( 'aria-label', themeSnifferLocalization.copySuccess );
// Restore label.
$( event.trigger.parentElement ).mouseleave( () => {
case 'TIME_STR':
case 'TIME_CLOCK':
return 'Worked';
case 'ESTIMATE_MS':
case 'ESTIMATE_STR':
case 'ESTIMATE_CLOCK':
return 'Estimate';
}
});
this.txt = this._formatText(this.headlineCols, this.formattedRows);
}
}));
// dirty but good enough for now
const clipboard = new Clipboard('#clipboard-btn');
clipboard.on('success', (e: any) => {
this._snackService.open({
msg: T.GLOBAL_SNACK.COPY_TO_CLIPPBOARD,
type: 'SUCCESS'
});
e.clearSelection();
});
}
componentDidMount() {
// Support old API by trying to assign this.props.options first;
let options = this.props.options || this.propsWith(/^option-/, true);
this.clipboard = new Clipboard(`#${this.id}`, options);
let callbacks = this.propsWith(/^on/, true);
Object.keys(callbacks).forEach(function (callback) {
this.clipboard.on(callback.toLowerCase(), this.props[`on${callback}`]);
}, this);
}
enableCopy () {
if (this.clipboard) {
this.clipboard.destroy()
}
this.clipboard = new Clipboard(this.$refs.copy.$el, this.clipboardOptions)
this.clipboard.on('success', (event) => {
this.snackbar = true
this.copyFailed = false
this.$emit('copy')
})
this.clipboard.on('error', err => {
console.error('error', err)
this.copyFailed = true
this.snackbar = true
this.$emit('copyFailed')
})
}
},
link: (scope: any, elem: any) => {
scope.clipboard = new Clipboard(elem[0], {
text: () => {
return scope.getText();
},
});
scope.clipboard.on('success', () => {
appEvents.emit('alert-success', ['Content copied to clipboard']);
});
scope.$on('$destroy', () => {
if (scope.clipboard) {
scope.clipboard.destroy();
}
});
},
};
$(() => {
const selector = ".btn";
const delay = 1000;
const clip = new ClipboardJS(selector);
const targetOf = (e): any => $($(e.trigger).data("clipboard-target"));
clip.on("success", e => tooltip(targetOf(e), I18n.t("js.copy-success"), delay));
clip.on("error", e => tooltip(targetOf(e), I18n.t("js.copy-fail"), delay));
});
}
onRender() {
Modal.prototype.onRender.apply(this, arguments);
const copyButton = this.$('.js-copy-to-clipboard');
if (copyButton.length) {
const clipboard = new Clipboard(copyButton.get(0));
clipboard.on('success', () => {
copyButton
.tooltip({
title: translate('users.tokens.copied'),
placement: 'bottom',
trigger: 'manual'
})
.tooltip('show');
setTimeout(() => copyButton.tooltip('hide'), 1000);
});
}
this.newToken = null;
},
componentDidMount() {
this.clipboard = new Clipboard(this.copyButton);
}
import React, {Component} from 'react';
import dagreD3 from 'dagre-d3'
import d3 from 'd3'
import {Tabs, Tab, Table} from 'react-bootstrap';
import Clipboard from 'clipboard';
new Clipboard('.btn');
class Grapher extends Component {
constructor(props) {
super(props);
this.state = {};
this.state.selectedTask = {};
this.state.logs = {};
this.grapher = new dagreD3.render();
this.setSvgRef = elem => this.svgElem = elem;
this.setDivRef = elem => this.divElem = elem;
this.setPropsDivRef = elem => this.propsDivElem = elem;
let starPoints = function (outerRadius, innerRadius) {
var results = "";