Skip to content

Instantly share code, notes, and snippets.

@mrfr0g
mrfr0g / selection.js.diff
Created May 15, 2013 16:28
Fix for CKEDITOR 4.0 color palette button on iOS 6. Essentially CKEDITOR is trying to perform a lock/restore on the selection when it detects a blur event. Unfortunately this causes some "flashing" behavior on iOS when the browser tries to focus on the color button, then back on the editor, and landing finally on the body. This also results in t…
Index: selection.js
===================================================================
--- selection.js (revision 39613)
+++ selection.js (revision 39615)
@@ -218,10 +218,12 @@
else
editable.attachListener( editor, 'selectionCheck', saveSel, null, null, -1 );
- editable.attachListener( editable, 'blur', function() {
- editor.lockSelection( lastSel );
@mrfr0g
mrfr0g / d3.selection.tooltip.js
Created July 10, 2013 16:58
Simple modification of Bootstrap's tooltip method to allow tooltips on arbitrary d3 selections. Usage example, d3.selectAll('g.circle') .tooltip(); // Looks at the `tooltip` property of the datum. d3.selectAll('g.circle') .tooltip('Uses this value as the tooltip for the selection'); d3.selectAll('g.circle') .tooltip(function (d) {return 'any val…
(function () {
// Bootstrap provided getPosition uses offsetWidth and offsetHeight to calculate
// the positioning of the tooltip. SVG Elements do not have this property because
// SVG does not layout elements, it assumes elements are always positioned.
// This replaces their implementation for SVG elements, and utilizes getBoundingClientRect.
var getPosition = $.fn.tooltip.Constructor.prototype.getPosition;
$.fn.tooltip.Constructor.prototype.getPosition = function (inside) {
var svgParent = this.$element.parents('svg');
// Only apply to SVG children
// Test for iOS 3/BlackBerry