Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This problems seems to be an issue on some web servers with filenames with ".cookie" in them. It took me a while to find the solution, so I thought other users of this module might appreciate the info. Perhaps the default file names could change to use an underscore to avoid any changes?
* Rename /sites/all/modules/text_resize/jquery.cookie.js to jquery_cookie.js ("." to "_")
* In your page.tpl.php file in your theme templates folder (or copy from your base theme) change
print $scripts;
to
print str_replace("jquery.cookie.js", "jquery_cookie.js", $scripts);
Hope this helps.
Comments
Comment #1
attheshow CreditAttribution: attheshow commentedBecause the jquery cookie is an existing project outside of Text Resize, I'd rather stick with the name of the current project file. Thanks for the info though.
Comment #2
MJD CreditAttribution: MJD commentedFor anyone using CiviCRM... this module will break all the CiviCRM javascript (JS) for dates / access keys etc on most admin pages...
As the maintainer has marked this as "won't fix"... I'm just posting this for anyone else who may experience problems now or in the future...
p.s. I'm still checking but I think it is the $.cookie that's the problem in jquery.cookie.js
Comment #3
fuerst CreditAttribution: fuerst commentedThe reason for this error probably is you are using multiple jQuery installations at the same page. That's the case when running CiviCRM (at least 3.1.3) as Drupal module. The jQuery documentation has a solution for this: http://api.jquery.com/ready/ (in the Aliasing the jQuery Namespace section).
You can get it working by changing line 4 of modules/text_resize/text_resize.js from
$(document).ready(function() {
to
$(document).ready(function($) {
BTW: Same issue in the Superfish module: #761034: Superfish and CiviCRM 3.1.3 conflict
Comment #4
jhedstromWhy not use Drupal.behaviors instead?
Comment #5
attheshow CreditAttribution: attheshow commentedStill haven't seen a convincing argument for changing the code here. Setting back to won't fix.
Comment #6
mrfelton CreditAttribution: mrfelton commentedThis is definitely a problem when using in conjunction with CiviCRM. Using
Drupal.behaviors
would surely be a better approach... any specific reason why you are not using Drupal.behaviors?Comment #7
attheshow CreditAttribution: attheshow commentedRead a little more about Drupal.behaviors and it sounds like that is a convention. Give the dev version a shot please and see if this fixes the issue.
Comment #8
mparker17@attheshow — I've confirmed that it works correctly with Drupal 6.19, CiviCRM 3.2.0 and the development version of text_resize-6.x-1.x from 2010-Sep-26!
Someone should probably test and confirm that it works with the latest stable CiviCRM before marking it as RTBC.
Comment #9
attheshow CreditAttribution: attheshow commentedComment #11
3dloco CreditAttribution: 3dloco commentedReopening as I am still getting this error even after upgrading to 1.6...
Firebug points to text_resize.js
Comment #12
attheshow CreditAttribution: attheshow commentedAre you using CiviCRM? Or is your issue unrelated to the issue above? Just the same error?
Comment #13
attheshow CreditAttribution: attheshow commentedRe-marking this as fixed.
Comment #14
EmperorForearm CreditAttribution: EmperorForearm commentedI'm getting the same javascript error as 3dloco using the latest 1.6 version, but I am not using CiviCRM. I have this module working on a different site (with a different theme) and would love to get it working on this current site as well.
Comment #15
EmperorForearm CreditAttribution: EmperorForearm commentedRealizing that I haven't included much information I wanted to add the following in the hopes of getting a response:
Drupal Core 6.22
Theme is from Template Monster and required explicit loading of Jquery (isn't included in the print $scripts action)
In addition to not re-sizing the page when the options are selected, it breaks the yui menu.
Comment #16
mbsmetal CreditAttribution: mbsmetal commentedHi,
Just Copy the line of code in below of 'print $scripts;' in page.tpl.php file (ur Theme Directory):
this line will insert jquery.cookie.js in your theme.
Comment #17
attheshow CreditAttribution: attheshow commented@EmperorForearm - I'm going to need to know how to duplicate the problem before I can do anything to fix it. Do you have a public-facing site that showcases the error you mention?
Comment #18
EmperorForearm CreditAttribution: EmperorForearm commented@mbsmetal Thanks for the tip , but I've tried calling jquery.cookie.js using the line you provided (file location changed appropriately) as well as a couple of other versions with no luck.
@atttheshow I've messaged you a site where you can see the error, the conversation can continue there or here as appropriate. (obviously the solution should end up here)
Comment #19
EmperorForearm CreditAttribution: EmperorForearm commented@mbsmetal Thanks for the tip , but I've tried calling jquery.cookie.js using the line you provided (file location changed appropriately) as well as a couple of other versions with no luck.
@atttheshow I've messaged you a site where you can see the error, the conversation can continue there or here as appropriate. (obviously the solution should end up here)
Comment #20
attheshow CreditAttribution: attheshow commented@EmporerForearm, I do see that error on your site you emailed to me, but it looks like the necessary .js files are included in the head tag. I'd try disabling other custom scripts to see if one of those is causing the problem. Also, be sure you are using $scripts to print out all JS. That could well be the problem if the theme has the funky configuration you mentioned above.
Comment #21
EmperorForearm CreditAttribution: EmperorForearm commentedI've found the culprit
<script type="text/javascript" src="<?php print base_path().path_to_theme() ?>/js/jquery00.js"></script>
This code is in the page.tpl file, and is for the slider that comes with the theme. Unfortunately, removing it causes the image slider not to work (the only part that was working).
After much ado, I was able to get the problem script loaded in the template .php by adding the line
Now the menu, slider, and text resize all play nice together
Thanks for your patience, and help.
Comment #22
novicesmith CreditAttribution: novicesmith commentedI donot know whether this will help
I change the code and it help
Comment #23
avinash_thombre CreditAttribution: avinash_thombre as a volunteer and commentedThere are instances when $.cookie function does not work. For such instances use another method. Place this code in your js file:
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
Then you can use, setCookie(cname, cvalue, exdays) and getCookie(cname) to use set and get cookie functionalities.