Jump to content

Conflicting javascript libraries using page with wrapper


LuckyRiver

Recommended Posts

Posted

Hi,

I have the following issue:

If I run my own page without IPS Wrapper, my javascript are on bottom of the page and ips wrapper which have its own javascript on the top. It works fine.

If I use that page as a custom block inside an another page feed as custom block, then the page is generated with  my included javascript libraries are on top of the page and ips javascript libraries are on bottom  . It seems like there is conflicting javascript version and mine got overwritten. I can't use a different version of javascript otherwise exception are generated as it happens in my case. Thus my page no longer works as it is when it is without ips wrapper.

I don't know how to fix this. Is there any alternative way to tell the page generator, to force my javasscript libraries to be last included and generated at the bottom without beeing overwritten by ips javascript librairies?


As an example

IPS Wrapper

       
    <link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/341e4a57816af3ba440d891ca87450ff_framework.css.15d8aa76d5de7704d0206323edbb37cd.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

    <link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/05e81b71abe4f22d6eb8d1a929494829_responsive.css.2256c7ca2f5984069c63c9b849650ecc.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

    <link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/90eb5adf50a8c640f633d47fd7eb1778_core.css.5f275cfddec7c8e15eeb11b8d1ddb52d.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

    <link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/5a0da001ccc2200dc5625c3f3934497d_core_responsive.css.429e380312e6b77cda1cc00236f0dc74.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

    <link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/20446cf2d164adcc029377cb04d43d17_flags.css.c006289823d0b5967d8b1eda28f0ad17.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

 

<link rel='stylesheet' href='http://YOURSITEURL/uploads/css_built_1/258adbb6e4f3e83cd3b355f84e3fa002_custom.css.98ab3492771e27c7e2503c32a2dec55a.css?v=2c3459036b70d5b7ba43500d03ae4ceb' media='all'>

        
    <script type='text/javascript'>
        var ipsDebug = false;        
    
        var CKEDITOR_BASEPATH = 'http://YOURSITEURL/applications/core/interface/ckeditor/ckeditor/';
    
        var ipsSettings = {
            
            imgURL: "",
            baseURL: "http://YOURSITEURL/",
            jsURL: "http://YOURSITEURL/applications/core/interface/js/js.php",
            csrfKey: "dc78dedf22b7c1ad6770234e750da97b",
            antiCache: "2c3459036b70d5b7ba43500d03ae4ceb",
            useCompiledFiles: true,
            links_external: 1
        };
    </script>

 

<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_global/root_library.js.7a00927eee7eaa82fcb9cf3d42aab071.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_global/root_js_lang_1.js.c61d0664af91137080e4d4f4ea731e2a.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_global/root_framework.js.9e5b3880a6fd9fa449a00b42928ded1a.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_core/global_global_core.js.a8f61417d9af872dd2c864dc2b205006.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_global/root_front.js.5db408869113e9c080349088f65e778b.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


<script type='text/javascript' src='http://YOURSITEURL/uploads/javascript_core/front_front_widgets.js.27e5a9499428cedc2c70c7be38094b46.js?v=2c3459036b70d5b7ba43500d03ae4ceb' data-ips></script>


My jquery javascript

    <script type="text/javascript" src="lib/jquery-1.11.1.js"></script>
    <script type="text/javascript" src="lib/jquery.rwdImageMaps.min.js"></script>
    <script type="text/javascript" src="lib/jquery.maphilight.min.js"></script>
    <script type="text/javascript" src="lib/jquery.qtip.min.js"></script>
    <script type="text/javascript" src="lib/imagesloaded.pkg.min.js"></script>


Any pointer is appreciated!

 

 

Posted

In \IPS\Output....
 

	/**
	 * @brief	Anything set in this property will be output right before </body> - useful for certain third party scripts that need to be output at end of page
	 */
	public $endBodyCode = '';

 

so something like

 

\IPS\Output::i()->endBodyCode = \IPS\Output::i()->endBodyCode . "<script src='...'></script>";

 

  • 2 weeks later...
Posted

Thanks brandon for the code snippet!  Will try that though. I missed your reply. I will experiment that, meanwhile I had to manually manage that page and have links to forum. Definitely will try what you suggest! It will be nice if it works to have integrated of what I currently have since I wanted a 2 columns with announcement on top and a footer for online users.

It's still work in progress but I'm getting somewhere: http://famepoker.com! :)

Posted

In \IPS\Output....
 

	/**
	 * @brief	Anything set in this property will be output right before </body> - useful for certain third party scripts that need to be output at end of page
	 */
	public $endBodyCode = '';

 

so something like

 

\IPS\Output::i()->endBodyCode = \IPS\Output::i()->endBodyCode . "<script src='...'></script>";

 

​Brandon, which php file should I add the code and any specific place to add the code in too? I scan the folder recursively, there is tons of php files? Any pointer is appreciated! Thx!

Posted

In \IPS\Output....
 

	/**
	 * @brief	Anything set in this property will be output right before </body> - useful for certain third party scripts that need to be output at end of page
	 */
	public $endBodyCode = '';

 

so something like

 

\IPS\Output::i()->endBodyCode = \IPS\Output::i()->endBodyCode . "<script src='...'></script>";

 

​ Did not work for me? I did add the above php block inside as a tag inside the html code. Seems like it did not change anything in the way my own custom javascript includes are not generated last? Going to debug this more when I got home.

Posted

Hi Brandon,

 

I did a simple test with the following code as a manual html page

<head>
</head>
<body>
  {block="phpjs"}
</body>

Assuming that the php block has the key named phpjs and its content shown below

{block="phpjs"}

I've added 

\IPS\Output::i()->endBodyCode = \IPS\Output::i()->endBodyCode . "<script type="text/javascript" src="lib/jquery-1.11.1.js"></script><script type="text/javascript" src="lib/jquery.rwdImageMaps.min.js"></script><script type="text/javascript" src="lib/jquery.maphilight.min.js"></script><script type="text/javascript" src="lib/jquery.qtip.min.js"></script><script type="text/javascript" src="lib/imagesloaded.pkg.min.js">/script>";

 

When viewing page source, I don't see anything output from the function \IPS\Output eg my version of js : imagesloaded.pkg.min.js

Any clue why it does not append my code at end?

Thanks!

Posted

Anyone here uses \IPS\Output in a php custom block, i retry the code in my last reply with RC1, nothing is output from viewing page source code? Any help is appreciated!

Only the below lines are shown:

 

<head>
</head>
<body>
  
</body>
  • 4 weeks later...
Posted

Just drop by to let that I sorted out the issue but using a different method to insure that correct javascript version of javascript is not affected by IPS own ones. I think it's cleaner this way. To do that I have to use iframe method as someone has explained how to do it in another unrelated topic and it turns out nicely . Attached are some screen shots which I manage to get the metro mapper working using a custom block which has an html iframe code to represent the image and the javascript which performs a restful webservice call to the game to pull out game data and image for display!

66785

66786

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...