Everything posted by Tesset
- Today...
-
Reading in from an external file in javascript
Yeah, I'm not going to be able to get to this until this weekend at least. Thanks for your help though guys, that explained something I would have taken forever to figure out.
-
Things that annoy the HELL out of you.
Do I have to wave my own penis, or can it be someone else's?
- Today...
- Today...
-
how many warning points do you have?
What? How the heck am I supposed to catch up to that!? I worked so hard to get #10, thinking I just had to get 1 more to be tied for top spot, and now there's a 16? *grumble grumble*
-
Reading in from an external file in javascript
Over the past few months, I have been working on updating my tumblr blog's theme. The blog is a writing blog, and one of the important things I wanted to do with it was have the stories/poems I put up be readable in a "book" format, where the text would be read in from an external file and then converted into pages which the reader could then read through, turning pages as necessary, etc. etc. As a preface for this, the only HTML and javascript I've ever worked with have been for this project, so I don't know a whole lot. In particular, my javascript skills are not really up to the thing I'm trying to do, but I've found that the only way I'm willing to learn a coding language is if I actually have a project or a goal to work towards with it. So I just jumped in. My question is twofold. First, I am wondering about my code: window.onload = function storybook(){ var leftwrite=toArrayFromFile(); var rightwrite="Pull right page from external file."; document.getElementById("left").innerHTML=leftwrite; document.getElementById("right").innerHTML=rightwrite; return; } function toArrayFromFile(){ var filePath ="https://dl-web.dropbox.com/get/To%20Read.txt?w=AADEw2vKPnayknuLZoalIWplbQqpCe0pv1WqMcmHLsuZKQ"; xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET",filePath,false); xmlhttp.send(null); var fileContent = xmlhttp.responseText; var fileArray = fileContent.split('\n'); return fileArray; } The toArrayFromFile function is something I found on the internet - I don't know how it works exactly, but what it's supposed to do is read in the file from filePath and convert it into an array at the line breaks. My question is, will this do what I want? If it will, can you explain how, or link to documentation for the XMLHttpRequest class/API/whatever it's called in JS? If not, how should I be doing this? My second question is what I asked in the today thread. To give a bit more of an explanation of what the problem is: tumblr does not allow you to upload assets to your site/blog. With a few exceptions, if you want something like a custom reblog button image, you have to upload the files yourself, on an external site, or post them as an image post on your blog. There's no way to give files to the tumblr server otherwise. I was fine with images - I just uploaded them to my imageshack account and used them that way. The problem comes when I try to upload the text files containing my stories. I can't upload them to my own site, so I tried looking at things like Dropbox and (at others' suggestions) pastebin and Google Drive, but nothing I have found works - either it doesn't have the option, it doesn't have a link to the raw data, or it gives me a security error when I try to access it from the toArrayFromFile function. Looking at these: I'm not entirely sure 000webhost is what I want, and I'm a little lost trying to navigate github (though, I'll look at it again tomorrow because maybe I'm just being dumb who knows). Otherwise, I'm not sure what to do for this problem. Once I have these two things out of the way, I'm fairly confident that I can get everything up and running on my own - I worked out a solution to this problem in java a few months back as practice for a class, so I am pretty sure I know what to do from here. But I need to get this figured out first.
-
Today...
Just off the top of my head, paste bin. I think Google Drive could do something like that. Probably not show it in the browser but would at least let the download work. Usually sites don't let you upload txt files because of security issues. Just save it as an HTML file and it should work. So, finally got through all of these suggestions (I've been avoiding the whole thing). Pastebin didn't give a direct link anywhere I could find, even under the raw and embed options. Drive does not have a share option like that. I tried making a page on my tumblr and just .js into there as a piece of custom layout, but that didn't work either, because tumblr adds its own pieces of code to every page. Back to where I started with this. Tbh, I think I'll just open a thread in the tech forum when I get home, this is too much of a pain.
-
Things that annoy the HELL out of you.
On the other hand, having no one who will give you feedback. Everyone who reads my fiction writing either just tells me they like my writing style and that's it, or they tell me they couldn't get through the first sentence/paragraph/page and nothing else. The only thing I ever get feedback on is essays, and I don't really care about those.
- It's Super Effective!
- Today...
-
Today...
I'm sure someone on here knows of something like this: I'm looking for a site where I can upload txt/js/whatever-type files and have them be accessible to another site. Tumblr doesn't allow you to upload files to their servers unless they're one of the file types for posts, so I need an external site. I tried using dropbox, and it worked for the .js file loading from the HTML source, but not for a .txt file I was loading from one of the scripts in the first file. It gives me a 403 security error instead of reading the file in. Of course, I could just be doing something wrong on the javascript. God knows that's possible, considering how little I understand it. :/
- Today...
-
It's Super Effective!
Well aside from being harder to draw, : That sounds so difficult. I'm not sure how that would work. Seems like a really easy way to get hurt (for both parties). Plus its a playground, like for little kids. Sounds a little illegal. [hide] swing sex +4 3 2 1[/hide] Just read this page 'cuz there was like 50 pages since I last got on and I don't want to catch up. But I saw this, and it reminded me of this really weird dream I had the other day. I was a wizard or some shit, and I was running around the countryside turning people into newts, like I do, and there was this one dude who was also a wizard. And we got into some crazy wizard fight, and he almost killed me, but I managed to turn him into a newt. Except my spell failed for whatever reason, so he turned into a swingset, but like a stupid swingset with only one swing even though there was room for like three (actually, thinking about it, I think the other two swings were broken off). But he was a wizard, so he tried to change back, but before he could, I teleported him to some other world where he couldn't cast magic, so he'd be stuck like that forever. Then I teleported a cow that was just kind of standing by. I don't know why I did that. Like, I remember thinking in my dream, "I should teleport this cow where he went!" and I did, but when I woke up, that was the most surreal part of the dream, and it kind of creeps me out thinking about it now. Then the dream cut to me looking through a crystal ball, and I was look at two people having sex on a swingset that could make fences with it's swing. They were all over that swingset, like, on the bars, and on the swing-face, and up on the top and like floating over it and everywhere. It was pretty gross. And then I woke up and was like, "why did I teleport the cow?"
- Today...
- Today...
- Today...
- Today...
- Today...
- Today...
- Today...
- It's Super Effective!
-
Things that annoy the HELL out of you.
Though, I will be honest, I kind of miss the [cabbage] censor. Not because I'm offended by the word shit, but because it was just kind of iconic, and for a long time I had trained my brain to read cabbage as shit. Like, there was just one day I was on Facebook, and someone said cabbage in the context of food or something, for whatever reason, and I was really confused for a second.
-
Things that annoy the HELL out of you.
This isn't exactly a formal environment. OT is a forum, on the internet, of a bare handful of people who are all pretty closely knit. I don't think anyone's saying you don't have a right to be offended, just that it's not worth it.
- It's Super Effective!