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.
I want to turn off AdvAgg for the H5P node type. Apparently there is a conflict or bad javascript in the H5P such that jsmin does not work. I have also tried disabling js minimization for all H5P files, but that did not help. So next step disable AdvAgg entirely for H5P nodes.
But how can I do that?
Comment | File | Size | Author |
---|---|---|---|
#17 | advagg-2803335-16-do-not-wrap-h5pint-inline.patch | 683 bytes | mikeytown2 |
#15 | H5P-JS-Aggregation-Problem4.jpg | 279.96 KB | webservant316 |
#15 | H5P-JS-Aggregation-Problem3.jpg | 256 KB | webservant316 |
#15 | H5P-JS-Aggregation-Problem2.jpg | 262.1 KB | webservant316 |
#15 | H5P-JS-Aggregation-Problem.jpg | 312.62 KB | webservant316 |
Comments
Comment #2
webservant316 CreditAttribution: webservant316 commentedPerhaps I could manually set $_GET['AdvAgg']=1 if $node->type=='h5p_content'. But what hook would I use to make this assignment?
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedhook_init() or hook_page_alter() will work.
Comment #4
webservant316 CreditAttribution: webservant316 commentedWorks! awesome, Thanks! That could a feature request for AdvAgg. Add the ability to enable or disable by content type and or path, similar to Block visibility. AdvAgg is awsome, however, it does not play well with certain modules and so this could increase the use base if it was easier to disable AdvAgg for problematic situations.
Changing to feature request.
Comment #5
webservant316 CreditAttribution: webservant316 commentedComment #6
webservant316 CreditAttribution: webservant316 commentedI needed to extend this to also turn of AdvAgg for H5P quiz questions...
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commentedAny way to ID the js that is causing issues for you? What js compressor are you using? Under Licensing comments on the js compression page select the "Do both; try to keep important comments and provide a link" radio and then open up the browser console. Any JS errors should be listed there. Once you know the file that is causing issues you should be able to pinpoint the js that is not getting minified correctly.
Comment #8
webservant316 CreditAttribution: webservant316 commentedusing jsmin, the compiled C version, though the php jsmin also fails the same way.
I am using FF, but don't understand how to copy the errors out of the browser console. Any tips. I do see related errors, but not sure how to get the what is helpful over here. Below are the error messages and the lines of code.
H5P Chart - Instance undefined error on this line
else if(instance.$!==undefined&&instance.$.trigger!==undefined){instance.$.trigger(eventType);}};H5P.on=function(instance,eventType,handler){if(instance.on!==undefined){instance.on(eventType,handler);}
H5P Chart - Unable to find constructor for: H5P.Chart 1.0
return instance;};H5P.error=function(err){if(window.console!==undefined&&console.error!==undefined){console.error(err.stack?err.stack:err);}};H5P.t=function(key,vars,ns){if(ns===undefined){ns='H5P';}
H5P Multiple choice - Missing ';' before statement
EJS.Helpers.prototype.date_tag=function(name,value,html_options){if(!(value instanceof Date)) value=new Date() var month_names=["January","February","March","April","May","June","July","August","September","October","November","December"]; var years=[],months=[],days=[]; var year=value.getFullYear(); var month=value.getMonth(); var day=value.getDate(); for(var y=year-15;y<year+15;y++) { years.push({value:y,text:y}) } for(var m=0;m<12;m++) { months.push({value:(m),text:month_names[m]}) } for(var d=0;d<31;d++) { days.push({value:(d+1),text:(d+1)}) } var year_select=this.select_tag(name+'[year]',year,years,{id:name+'[year]'}) var month_select=this.select_tag(name+'[month]',month,months,{id:name+'[month]'}) var day_select=this.select_tag(name+'[day]',day,days,{id:name+'[day]'}) return year_select+month_select+day_select;}
H5P Multiple choice - Unable to find constructor for: H5P.MultiChoice 1.6
return instance;};H5P.error=function(err){if(window.console!==undefined&&console.error!==undefined){console.error(err.stack?err.stack:err);}};H5P.t=function(key,vars,ns){if(ns===undefined){ns='H5P';}
H5P Multiple choice - Instance is undefined
else if(instance.$!==undefined&&instance.$.trigger!==undefined){instance.$.trigger(eventType);}};H5P.on=function(instance,eventType,handler){if(instance.on!==undefined){instance.on(eventType,handler);}
Comment #9
mikeytown2 CreditAttribution: mikeytown2 commentedDidn't know this was from a module
https://www.drupal.org/project/h5p
https://www.drupal.org/project/quiz_h5p
I'm assuming that you've tried the "Per File Settings" on the
admin/config/development/performance/advagg/js-compress
page and disabled compression for the js files right?Once we have a good way to reproduce the bug, filing a bug report here should be helpful https://github.com/sqmk/pecl-jsmin
Comment #10
webservant316 CreditAttribution: webservant316 commentedYes I tried turning off compression for all the h5p js files, but that did not work. I am not sure why. However, disabling AdvAgg entirely for H5P nodes does solve my problem.
Comment #11
mikeytown2 CreditAttribution: mikeytown2 commentedComment #12
mikeytown2 CreditAttribution: mikeytown2 commentedLooking for the strings of text found in #8 in https://github.com/h5p/h5p-chart and I'm coming up empty. https://h5p.org/node/6729 is the chart; I have https://www.drupal.org/project/quiz_h5p installed and trying to reproduce this issue, but having trouble. What versions of everything are you using?
Comment #13
webservant316 CreditAttribution: webservant316 commentedDrupal 7.50
Advanced CSS/JS Aggregation 7.x-2.18
H5P - Create and Share Rich Content and Applications 7.x-1.18
Quiz 7.x-4.0-rc2
+100 other modules
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedWas using the 5.x branch of quiz. switched to the 4.x branch and I still can't reproduce this. Here's an example screenshot of the per file settings. Can you give me a screenshot of the files you have disabled? Knowing the filename would be very helpful.
Comment #15
webservant316 CreditAttribution: webservant316 commentedI have attached a list of the H5P files, but I don't think that will help. I was not able to fix the problem by excluding compression for a particular file, but only by turning compression completely off for H5P Chart and Multiple Choice.
I used this code which forces no aggregation for all H5P types and all Quiz questions. It is a brute force solution, but it works.
Also see attached screen shots.
Comment #17
mikeytown2 CreditAttribution: mikeytown2 commentedI did have one problem with defer/footer. This fixes the intermittent issue I was encountering. Still working on reproducing your exact issue.
Comment #18
mikeytown2 CreditAttribution: mikeytown2 commentedI can't reproduce this issue; reopen if there is an actionable code change that can be made.