javascript - prototype.js and some other js's conflicts -
i don't know things javascript , don't have friends knows javascript :( that's why im asking stackoverflow community again help. i've got new template script problem have conflicts on prototype.js required script work js's template , dont know how solve problem, because template wont work without comments js, main js , script wont work without prototype js dont know if has time take in scripts , maybe give solution merge them, because big scripts, @ last try.
i have uploaded scripts on locations , putted links here
pastebin.com/n5dnr6i7 here main.js required template pastebin.com/yisntubm comments.js recuired template pastebin.com/cibn1na2 prototype.js required main script
comments , main not working prototype loaded
thank in advance!
edit: im sorry posting in java correction
edit 2: problem web script encrypted ioncube , have access template html files, bit complicated because template modified/cracked verion of web script im using, video tube script , example original web script have uses comments.html included in video.html cracked/modified different , had include old comments.html file in new video.html template, if use jquery-1.9.1 comment area box slide down should when click cant comment video if use prototype can comment video comment area box frozen doesent slide down when click it, , have no ideea how merge them
i've added files to jsfiddle, , sure prototype required? i've commented out , replaced jquery (as comments file seems require it, combined [main] file).
after doing no errors on page load.
<!-- prototype --> <!--script src="http://pastebin.com/raw.php?i=cibn1na2"></script--> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <!--script>jquery.noconflict();</script--> <!-- comments --> <script src="http://pastebin.com/raw.php?i=yisntubm"></script> <!-- main = modernizr + extras --> <script src="http://pastebin.com/raw.php?i=n5dnr6i7"></script>
edit comments: second fiddle show use of jquery noconflict()
:
the setup - either leave both script tags uncommented, or try commenting 1 or other see errors get.
the tests use addclass
function of jquery, , addclassname
function of prototype in order see version of $
active. 1 or other of methods fail depending on $
active @ time.
<!-- comment 1 of these script tags, or leave both uncommented noconflict mode --> <!-- jquery must come second in order use noconflict --> <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script> <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
the tests:
// local var jquery - might undefined if jquery not imported var jquery = window["jquery"]; // if jquery exists, put noconflict mode - i.e. return jquery $ prototype $ if (jquery) jquery.noconflict(); try { // addclassname prototype only, not jquery $("output").addclassname("prototype"); setoutput("$.addclassname ok"); } catch (e) { setoutput("prototype > $.addclassname error: " + e); } try { // addclass jquery only, not prototype $("output").addclass("jquery"); setoutput("$.addclass ok"); } catch (e) { setoutput("jquery > $.addclass error: " + e); } try { // try using jquery 'full' jquery name jquery("output").addclass("jquery"); setoutput("jquery.addclass ok"); } catch (e) { setoutput("jquery > jquery.addclass error: " + e); } // wrap code needs $ jquery $ in function. // , pass in jquery aliased $ within function. (function($) { try { $("output").addclass("jquery"); setoutput("$.addclass ok when wrapped"); } catch (e) { setoutput("jquery > wrapped $.addclass error: " + e); } }(jquery));
sample output when both prototype , jquery included:
$.addclassname ok jquery > $.addclass error: typeerror: $(...).addclass not function jquery.addclass ok $.addclass ok when wrapped
Comments
Post a Comment