[fixed] My "new topic" button doesn't load the composer on first load
-
@julian nope. nothing happens.
I do get this in the console, though.Failed to load resource: the server responded with a status of 404 (Not Found) http://10.1.10.130:4567/404 Hello. This message was sent from scripts/inject.js
-
@julian How can I force the composer load?
-
@Giorgio-Chiodi said:
$(document.getElementById('sidebar-new-topic')).on('click', function() { cmp.newTopic(1); }); });
Hm, this doesn't look right... What happens when you copy this into your web console? ``` js $(document.getElementById('sidebar-new-topic'));
-
@julian said:
$(document.getElementById('sidebar-new-topic'));
$(document.getElementById('sidebar-new-topic')); [ <button id=​"sidebar-new-topic" class=​"btn btn-primary">​NEW TOPIC</button>​ ] Hello. This message was sent from scripts/inject.js
-
@julian yeeeeessss!
here's the console output
require(['composer'], function(cmp) { console.log(cmp, cmp.newTopic); }); function r(i,l,u){var p,d;return s.enableBuildCallback&&l&&J(l)&&(l.__requireJsBuild=!0),"string"==typeof i?J(l)?c(B("requireargs","Invalid require call"),u):n&&t(k,i)?k[i](D[n.id]):h.get?h.get(_,i,n,r):(p=o(i,n,!1,!0),p=p.id,t(P,p)?P[p]:c(B("notloaded",'Module name "'+p+'" has not been loaded yet for context: '+e+(n?"":". Use require([])")))):(b(),_.nextTick(function(){b(),d=a(o(null,n)),d.skipMap=s.skipMap,d.init(i,l,u, {enabled:!0}),f()}),r)} nodebb.min.js?v0.4.3-4-g60e5ba8:9 Object {newTopic: function, newReply: function, addQuote: function, editPost: function, addButton: function…} function (cid) { if(!allowed()) { return; } push({ cid: cid, title: '', body: '', modified: false, isMain: true }); } VM3558:3
-
@julian fixed! I used the code from http://nutritionask.com/
<button id="new-topic-button-widget" class="btn btn-lg btn-primary">NEW TOPIC</button> <script> $('#new-topic-button-widget').on('click', function() { if (!app.uid) { app.alertError('Hold up...take a second to register or log in, up there ⇧⇧⇧'); } else { require(['composer'], function(composer) { composer.newTopic(1); }); } }); </script>
Copyright © 2024 NodeBB | Contributors