Permalink
Browse files

make jQuery dependent bits compatible with jQuery.noConflict(); fixes #…

  • Loading branch information...
1 parent 72d90e0 commit 32f925a2d185a573140fd97002168a78765451ce @dchester dchester committed Feb 23, 2014
View
@@ -9,6 +9,10 @@
<script src="../vendor/d3.v3.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+ <script>
+ jQuery.noConflict();
+ </script>
+
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js"></script>
<script src="../src/js/Rickshaw.js"></script>
@@ -166,7 +170,7 @@
graph.render();
-var preview = new Rickshaw.Graph.RangeSlider.Preview( {
@trishume

trishume Jan 22, 2016

@dchester In the case that you remember, do you know why you reverted to the boring range slider?

The preview one looks much nicer, works for me with this demo, and this removal actually made the previewXAxis line at the bottom of this file throw an error.

+var preview = new Rickshaw.Graph.RangeSlider( {
graph: graph,
element: document.getElementById('preview'),
} );
@@ -206,7 +210,7 @@
var smoother = new Rickshaw.Graph.Smoother( {
graph: graph,
- element: $('#smoother')
+ element: document.querySelector('#smoother')
} );
var ticksTreatment = 'glow';
@@ -1,5 +1,7 @@
var RenderControls = function(args) {
+ var $ = jQuery;
+
this.initialize = function() {
this.element = args.element;
@@ -17,7 +17,7 @@ Rickshaw.Graph.Ajax = Rickshaw.Class.create( {
request: function() {
- $.ajax( {
+ jQuery.ajax( {
url: this.dataURL,
dataType: 'json',
success: this.success.bind(this),
@@ -7,21 +7,21 @@ Rickshaw.Graph.Behavior.Series.Order = function(args) {
var self = this;
- if (typeof window.$ == 'undefined') {
- throw "couldn't find jQuery at window.$";
+ if (typeof window.jQuery == 'undefined') {
+ throw "couldn't find jQuery at window.jQuery";
}
- if (typeof window.$.ui == 'undefined') {
- throw "couldn't find jQuery UI at window.$.ui";
+ if (typeof window.jQuery.ui == 'undefined') {
+ throw "couldn't find jQuery UI at window.jQuery.ui";
}
- $(function() {
- $(self.legend.list).sortable( {
+ jQuery(function() {
+ jQuery(self.legend.list).sortable( {
containment: 'parent',
tolerance: 'pointer',
update: function( event, ui ) {
var series = [];
- $(self.legend.list).find('li').each( function(index, item) {
+ jQuery(self.legend.list).find('li').each( function(index, item) {
if (!item.series) return;
series.push(item.series);
} );
@@ -33,7 +33,7 @@ Rickshaw.Graph.Behavior.Series.Order = function(args) {
self.graph.update();
}
} );
- $(self.legend.list).disableSelection();
+ jQuery(self.legend.list).disableSelection();
});
//hack to make jquery-ui sortable behave
@@ -8,6 +8,9 @@ Rickshaw.Graph.Behavior.Series.Toggle = function(args) {
var self = this;
this.addAnchor = function(line) {
+
+ var $ = jQuery;
+
var anchor = document.createElement('a');
anchor.innerHTML = '&#10004;';
anchor.classList.add('action');
@@ -4,7 +4,7 @@ Rickshaw.Graph.JSONP = Rickshaw.Class.create( Rickshaw.Graph.Ajax, {
request: function() {
- $.ajax( {
+ jQuery.ajax( {
url: this.dataURL,
dataType: 'jsonp',
success: this.success.bind(this),
@@ -18,6 +18,7 @@ Rickshaw.Graph.RangeSlider = Rickshaw.Class.create({
var element = this.element;
var graph = this.graph;
+ var $ = jQuery;
var domain = graph.dataDomain();
var self = this;
@@ -65,6 +66,7 @@ Rickshaw.Graph.RangeSlider = Rickshaw.Class.create({
var element = this.element;
var graph = this.graph;
+ var $ = jQuery;
var values = $(element).slider('option', 'values');
@@ -20,6 +20,7 @@ Rickshaw.Graph.Smoother = Rickshaw.Class.create({
build: function() {
var self = this;
+ var $ = jQuery;
if (this.element) {
$( function() {

0 comments on commit 32f925a

Please sign in to comment.