You are not logged in.

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

1

Thursday, December 8th 2011, 9:22pm

conflicting javascript

Hi,

I noticed, once I registered my ipad licence, my Underscore.JS doesn´t work. When looking into the DOM, I see that krpano overwrites the _ object. I rather not put Underscore into another object (I like the syntax, and I the krpano object is only used internally), so is there a way to move the krpano javascript object to another object? Something like _krpano? a krpano.noConflict() mode :P

I tried:

Source code

1
2
3
4
5
	<script src="tour.js"></script>
	<script type="text/javascript">
		window._krpano = window._;
	</script>
    <script type="text/javascript" src="KrpanoJSF/vendors/underscore/underscore-min.js"></script>


But that basicly breaks Ipad compatibility

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Thursday, December 8th 2011, 9:44pm

For now I solved it by passing underscore in an automatic executing anomynous function

Source code

1
2
3
4
5
6
7
<script src="underscore.js"></script>
<script src="jquery.js"></script>
<script type="text/javascript">
(function($, _, undefined) {
  <!-- your code here is save from overwriting -->
}(jQuery, _));
</script>


But it would be nice, in the future to have the ability to move the _ krpano object to another object of choice (noConflict mode like jquery).

3

Wednesday, December 14th 2011, 6:25pm

Hi,

right, at the moment krpano uses a global variable named '_', but this will change in the next versions, then there will be no globals anymore,

best regards,
Klaus