You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

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
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

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).
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

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