Closed ouyang-lang closed 2 years ago
What is an "atOB" coding error? Do you have jquery and 3dmol is appropriate places so that import can find them?
import('jquery').then(($) => { console.log("jquery",$("#container").val()); import("../../3dmol.js/build/3Dmol-nojquery.js").then(($3Dmol) => { console.log("$3Dmol",$3Dmol); let viewer = $3Dmol.createViewer('container'); console.log('$3Dmol.download',$3Dmol.download) $3Dmol.download('pdb:2nbd',viewer,{onemol: true,multimodel: true},function(m) { m.setStyle({'cartoon':{colorscheme:{prop:'ss',map:$3Dmol.ssColors.Jmol}}}); viewer.zoomTo(); viewer.render(callback); }); }) })
This is my code, is it wrong to say d3.download after import? Sorry, I am new, the error is “Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded”
atob should be part of the window: https://developer.mozilla.org/en-US/docs/Web/API/atob
Can you verify that a simple standalone example works fine?
<div id="container" style="width: 100%; height: 100%"></div>
<script src="https://3dmol.org/build/3Dmol.js"></script>
<script type="module">
let viewer = $3Dmol.createViewer('container');
console.log('$3Dmol.download',$3Dmol.download)
$3Dmol.download('pdb:2nbd',viewer,{onemol: true,multimodel: true},function(m) {
m.setStyle({'cartoon':{colorscheme:{prop:'ss',map:$3Dmol.ssColors.Jmol}}});
viewer.zoomTo();
viewer.render();
});
</script>
Hello, can't, and open the link to show 404, error: DevTools failed to load SourceMap: Could not load content for https://3dmol.csb.pitt.edu/build/netcdfjs.js.map: HTTP error: status code 404,
can't what? What link? source maps aren't required - that message can be ignored.
Hello, I just tested it. It can be used normally when I directly introduce it into the Script of HTML page, but it always displays an error in the page of VUE format:
atob' on 'Window': The string to be decoded is not correctly encoded. at Object.$3Dmol.base64ToArray
And why is it trying to base64decode? You are fetching text data. If you have a simple vue.js environment you can provide I would appreciate it since there are issues with it but I have no experience with it.
I'll try and let you know
Hi - all of a sudden as of like today, my displays using https://3dmol.org/build/3Dmol.js have not been working - is this a bug? I tried the example suggested by dkoes, which does work, but not other standard ones.
E.g. the following, which worked up til this morning, does not now.
<html>
<body>
<script src="https://3Dmol.org/build/3Dmol-min.js" async></script>
<div style="height: document.height; document.body.offsetWidth; position: relative; padding: 400px; 50px"
class='viewer_3Dmoljs' data-pdb='4N8T' data-backgroundcolor='0xffffff' data-style='cartoon:color=spectrum'
data-surface='opacity:.7;color:white'></div>
</body>
</html>
Just to update, however - it works on MOBILE (iOS) but not firefox, chrome, safari. Also works in PowerPoint using the webviewer add-in.
To doubly clarify, I wondered if it was related to this issue, which I suspect given the timing?
Oh actually, doesn't work on iOS either now.
I'd moved autoload earlier in the page render process, but with async set, this meant that it was waiting for an event that had already happened. It should be fixed now. The inconsistent results you saw earlier were likely due to caching. Be sure to clear caches before testing.
Thank you! Everything works now!
my code import('jquery').then(($) => { console.log("jquery",$("#container").val()); import("3dmol/build/3Dmol-nojquery.js").then(($3Dmol) => { console.log("$3Dmol",$3Dmol); var viewer = $3Dmol.createViewer($("#container")); $3Dmol.download("pdb:4DM7",viewer,{},function(){ viewer.setBackgroundColor(0xffffffff); viewer.addArrow({ start: {x:-10.0, y:0.0, z:0.0}, end: {x:0.0, y:-10.0, z:0.0}, radius: 1.0, radiusRadio:1.0, mid:1.0, clickable:true, callback:function(){ this.color.setHex(0xFF0000FF); viewer.render( ); } }); viewer.render(); }); }) });
After I write the code according to the official website, it shows atOB coding error, I don't know how to solve it, why?