Jump to content

Heretic86

Members
  • Posts

    27
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Heretic86's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. No it is not. I am thankful for this site but your answers are not helpful, it should be part of standard class definition using syntax that I am unfamiliar with.
  2. Telling me what my priorities are isnt helping to make sure it works. And I am not using a proxy to do something that is part of the syntactical sugar of the language. If you dont know, say you dont know, because what you are telling me is not helping.
  3. Im gonna need a lot of classes and trying to keep code clean and minimal. Proxies just make a basic class look... well, messy. What about something like this? class Game_Var { constructor(){ this._data = [null]; const _self = this; _self.__proto__.value = function(id){ // do stuff here; } } } How do I define Getters and Setters in this? Or something similar... Edit: Let me be clear here. I dont want to call the property name from the outside, only the class instance and braces: //... some class definition var foo = new MyClass(); foo[1] = "bar"; if (foo[1] == "bar") alert("ok here");
  4. I need a Wrapper or a Class that can control the Max Length of an Array on setting a value... It might be possible with a Prototype too, which is fine... let myArray = new ArrayClassThing(); myArray.setMax = 50; // should be a const value set in Constructor or Prototype myArray[50] = "Foo"; // This should work fine, I know index starts at 0, but I am not using 0 so total of 50 myArray[51] = "Bar"; // Need to do nothing Javascript is different than Ruby where you can use special characters to define Getter and Setter methods: # Ruby Code class Array_Wrapper def initialize @data = [] end # Getter def [](id) if id <= 50 and @data[id] return @data[id] end end # Setter def []=(id,value) if id <= 50 @data[id] = value end end As far as I understand, cant use a "[]" as a Getter or Setter Method, and I need something that can do exactly that, just to control a Static Maximum Can anyone help out with this?
  5. Thank you! That's all I needed to know! It seemed to me that what was being sent was just a JSON Object and not the instance object I was thinking. And Im not gonna pressure to change a thing as I think having that open could be a security hole... And yes, the class definition is in a Module, and page code is all contained in an anonymous constructor, which makes debugging a bit more difficult... I will be sure to leave the name parameter wide open and allow all characters to be set just to be sure it can be used to run unwanted scripts, and make sure to not use CORS at all just so any remote code can also be downloaded and executed! Kitchen, if you recall, this is part of what i want my users to have access to, so they can create new instances of this class with that CORS code you helped with! Thank you again!
  6. I have two pages, in order to visually organize data. There is a LOT of data, so different pages are needed. I am using window.postMessage(msg) to transfer data between two open pages. // One page class MyClass { constructor(name, value){ this.name = name; this.value = value; } sayName(){ console.log(`name is ${name}`); } } const foo = new MyClass("Bob", 123); foo.sayName(); // works fine window.postMessage({myMsg : foo}); // Other Page ... function processMsg(msg){ msg.data.myMsg.sayName(); // no worky } As near as I can tell, it is treating my instance of my class as an object with no methods. What do I need to do for posting the instance of the object to the other page? Im hoping you guys are a bit more helpful than you've been on my other questions...
  7. Really? No one? Is this perhaps a bug in Firefox itself?
  8. How do I implement both Analyzer and set playbackRate in Firefox which works in Chrome?
  9. I am playing around with the Web Audio API now. I set up a test application to play back an audio file. One of my desired options (at least currently) is to shift the pitch. An easy way to do this is to adjust the playbackRate property. So, it seems to work fine in Chrome and Firefox. Great, lets make it awesomer! Is that a word? I call to preservePitch elsewhere in the code. I threw in the following code for a Canvas Spectrum Analyzer, which works great: function graphAnimator(){ requestAnimationFrame(graphAnimator); let fbc_array = new Uint8Array(analyzer.frequencyBinCount); analyzer.getByteFrequencyData(fbc_array); ctx.clearRect(0, 0, graph.width, graph.height); ctx.fillStyle = "#00FFAA"; for (let i = 0; i < 100; i++){ let x = i * 3; let h = -(fbc_array[i * 8] / 12); ctx.fillRect(x, 20, 2, h); } } function setupGraph(){ graph.width = 222; graph.height = 20; ctx = graph.getContext('2d'); aCtx = new window.AudioContext(); analyzer = aCtx.createAnalyser(); audio_source = aCtx.createMediaElementSource(audio); audio_source.connect(analyzer); analyzer.connect(aCtx.destination); graphAnimator(); } Now, once I do this, and I grab my slider and play with it (ok, that sounded better in my head just now) to adjust the Playback Rate, it works in Chrome but not in Firefox? Honestly I love the Spectrum Analyzer Canvas more than the rest of what I have so I am open to scrapping that stuff because I would rather be able to adjust the Pitch without having to adjust the Playback Rate. Ive seen a few scripts out there that can do that, but Im pretty well clueless on how to get them set up! Essentially, a Slider (Range) and adjust the Pitch without messing with the Playback Rate. I really want to dump the Playback rate and strictly ONLY adjust a Pitch. Any suggestions / samples to adjust the Pitch of a MP3 / Ogg / Oga file without needing to revert to adjusting the Playback Rate consistently on every browser? (Well... except Internut Exploder)...
  10. Hot Dog! (*bark bark*) It works now! Thank you very much! I knew it would be one small thing that I had missed! Ive been banging my head against a wall for weeks on this, and you got it fixed!
  11. I will put it back in. I had it in there initially. And this is posted above, but this is the error Im getting now: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.webucate.me/cors_csp/jsondata.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://www.webucate.me’). This is my Content Security Policy: <?php header('Cross-Origin-Resource-Policy: same-origin', false); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); function csp_policy(){ header("Content-Security-Policy: " . "default-src 'none';" . "sandbox allow-scripts;" . "base-uri 'none';" . "img-src 'self';" . "style-src 'self' css/*;" . "navigate-to 'none';" . "form-action 'none';" . "script-src 'report-sample' 'unsafe-inline' 'unsafe-eval' " . "https://" . $_SERVER['SERVER_NAME'] . "/cors_csp/js/video.js " . "https://" . $_SERVER['SERVER_NAME'] . "/cors_csp/jsondata.php " . "data: ;" . "worker-src 'self';" . "media-src https://" . $_SERVER['SERVER_NAME'] . "/cors_csp/playvideo.php;" . "connect-src https://" . $_SERVER['SERVER_NAME'] . ";" . "child-src 'none';" . "report-uri https://" . $_SERVER['SERVER_NAME'] . "/cors_csp/csp_violation/index.php;" . "report-to {\"group\" : \"default\", \"max_age\" : 1800, \"endpoints\" : [{ \"url\" : \"https://" . $_SERVER['SERVER_NAME'] . "/cors_csp/csp_violation/index.php\"}]};" . ""); } ?> What I would really like is a SIMPLE EXAMPLE that WORKS. So, Sandboxed Iframe, XHR or Fetch, and PHP must to read a cookie. I just cant seem to get a handle on the numerous headers that are all involved, and despite all the googling, I cant find any real working examples intended for demonstration purposes. Think you could help with that?
  12. I fingered it out. Wait, that came out wrong. Take Two, Action! I figured it out! Apparently this works much more way lots gooder-er... audio.ontimeupdate = function(){ audioController.value = audio.currentTime * (100 / audio.duration); currentTime.innerHTML = Math.floor(audio.currentTime / 60) + ":" + ("0" + Math.floor(audio.currentTime) % 60).slice(-2); totalTime.innerHTML = Math.floor(audio.duration / 60) + ":" + ("0" + Math.ceil(audio.duration) % 60).slice(-2); }
  13. I tried loadedmetadata too but not really getting very far. Format doesnt matter to me much, so I could care less if its an MP3, OGG, or a freakin 8 Track Tape, but I dont think the metadata on 8 Track Tapes is easily readable by Javascript. *idea* If I use a constant bit rate, could I use a Loaded and Total property?
  14. It seems like that would work but it does not work as expected Console log. console.log("Duration changed " + audio.duration); Duration changed 11.174603 Duration changed 21.363809 Duration changed 31.107482 Duration changed 41.431655 Duration changed 51.494603 Duration changed 61.37034 Duration changed 65.159546 Perhaps I need to look at another property? What I am looking for is the total duration of an .ogg file, not how much can currently play. Is there a better way to do this?
  15. Ok, let me try to explain my goal again. I want users to upload their own scripts that they can run in an iframe. Since that is pretty dangerous to other users, I think the best thing to do is sandbox scripts in an iframe. Perhaps I am wrong. And I can not simply say "never let users run their own scripts" because it directly contradicts my goals. Running user scripts safely is the MAIN GOAL. I think it is a good idea to also use CORS so that those scripts do not try to make calls to anything EXCEPT one specific location on my server where their scripts are loaded from. This includes Inline Scripts. To load those scripts, I need to be able to send an Ajax / Fetch request to that specific page to load their scripts, which requires a cookie to access which scripts are theirs, and ultimately edit and save those scripts. Since other users will run those scripts, the Cookie has to be HTTPONLY so one user can not read another users cookies. But when I send the Ajax / Fetch request to get their data, I cant read their cookie! I think it is something either in CORS or in the way that I making my javascript requests. Is this a better explanation?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.