15 Year Old JavaScript! Decoding Dreamweaver's MM_swapImage()

15 Year Old JavaScript! Decoding Dreamweaver's MM_swapImage()

Wes Bos

5 лет назад

11,308 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@andreasholt2633
@andreasholt2633 - 27.09.2019 17:32

Haha. Loved this video. Thumbs up.

Ответить
@mrinalkothari2687
@mrinalkothari2687 - 27.09.2019 17:36

Great ! Thumbs up for it ;)

Ответить
@RICO-sr2fn
@RICO-sr2fn - 27.09.2019 17:59

wow random alert,well hello)

Ответить
@Blizzard4135
@Blizzard4135 - 27.09.2019 18:07

True story: in 2001 I did an internship in a famous web agency in my country. They gave me some Javascript to customize. Since it was full of MM, I obviously spotted that it was created with Dreamweaver. In an agency with over 100 employees, this is not what I expected, and I reported it to my supervisor.
Then they gave me some other code, the same but with the MM removed. Needless to say, I was far from enthusiast...
And the code was far worse than what we saw here.

Ответить
@modiddymo
@modiddymo - 27.09.2019 18:11

I love that the file is called wtf.js - I wonder if MM really stands for Marc Maron? 😄

Ответить
@ElLevidente
@ElLevidente - 27.09.2019 18:14

Does this mean we're getting a vanilla JS course in the near future? 😮

Ответить
@guilhermesmuller
@guilhermesmuller - 27.09.2019 18:47

I remember those...

Ответить
@joshysmarty2540
@joshysmarty2540 - 27.09.2019 18:56

Pretty cool digging..

Ответить
@EduardoWeidmanBarijan
@EduardoWeidmanBarijan - 27.09.2019 19:22

That was interesting. I do remember Dreamweaver having all sorts of "black magic" back then. It is nice to see it was just some javascript behind the curtain

Ответить
@DanVega
@DanVega - 27.09.2019 19:34

What a throwback! Thanks for diving into this, that was a fun trip down memory lane.

Ответить
@r-i-ch
@r-i-ch - 28.09.2019 02:40

Cool. I know I find it easier to reverse engineer ugly/minified code when I use find+replace(in selection) to change the variable names from single letters where possible.

Ответить
@madtin
@madtin - 28.09.2019 11:40

was this code generated by dreamweaver?

Ответить
@TJHooper123
@TJHooper123 - 28.09.2019 21:50

It's crazy to think that you can eliminate all that javascript and just make some styled <a> tags.

Ответить
@junaidqadirb
@junaidqadirb - 28.09.2019 21:59

Man Whatcha Doin!

Ответить
@SunsetRacer
@SunsetRacer - 28.09.2019 23:48

True definition of HellCode.js Oh man i wonder how they felt when they code this :(

Ответить
@billfarrar6153
@billfarrar6153 - 29.09.2019 19:08

I suspect that the looping in MM_SwapImage is so that you can change multiple images at a time, so you can hover over one image, and 5 could change. I seem to recall there was a time when you'd slice up your images, so not all would be the one being hovered over That's probably also why that global array is an array because it undoes the toggle on everything in that array. I suspect there's a ton of edge cases where this breaks (but hey, just reload the browser, and you'll be fine!) ;) .

Ответить
@LouisLazaris
@LouisLazaris - 30.09.2019 05:55

Haha that’s awesome.

But is it not strange that they’re using PNGs? That would mean they would have updated the site to use PNGs while keeping that relic script...? Because I seem to recall this script predating the time when PNGs became commonplace. Unless they were using one of those scripts to add PNG transparency to old IE... yet another relic!

Ответить
@RoyMosby
@RoyMosby - 30.09.2019 09:17

I just ran into something that used this about month ago. The wildest thing is the code using it was written this year. Some people cannot let old things die.

Ответить
@RimantasLiubertas
@RimantasLiubertas - 30.09.2019 11:43

Are you drunk? First adds a comment "blank array" over document.MM_sr, 10 seconds later wonders what document.MM_sr is and can it be an array :O

Ответить
@rzkysyz
@rzkysyz - 01.10.2019 20:17

Dreamweaver was tha bomb! I remember they also have this proprietary templating system with repeating regions etc, to minimize code duplication. But then it all goes down the drain when i found out about PHP includes.

Ответить
@svitirur1665
@svitirur1665 - 02.10.2019 02:51

I am waiting for the javascript visualization course

Ответить
@CoryTheSimmons
@CoryTheSimmons - 03.10.2019 15:47

Contrary to comments, that JS really doesn't even look bad—especially when compared to something like a Webpack bundle. Like... you can reverse engineer those 50 lines but that same functionality in a React/Webpack app would be several thousand npm dependencies.

I feel so shitty that I skipped over vanilla DOM JS (mostly went straight from jQuery to React). It seems interesting and fun.

Ответить
@yasirhussain1875
@yasirhussain1875 - 05.10.2019 21:56

Dear Wes Bos, you have been a great mentor and guide and have shaped my career well. I thank you for your efforts. Happy Teachers Day…

Ответить
@petruciucur
@petruciucur - 06.10.2019 08:57

What theme for the editor?

Ответить
@jfichl
@jfichl - 08.10.2019 13:12

Even better would be if you demonstrate how you would do it today - sure, you can do it by using a link or div and :hover selector, but it will flicker when the hover is triggered first time, so a preload would be nice - at least for FF and Safari. Another way is to use CSS sprites, that would avoid the flicker.
If you throw the images away und just use web-fonts styled with hover, you could achieve the design here, but what if you really want to display another image on hover? Shouldn't an image be represented by an img tag (semantic web)?
The JavaScript style is horrendous, no question...

Ответить
@dumbsong1
@dumbsong1 - 15.10.2019 06:12

Listen to Syntax every morning, and have almost made my way through everyone! Wes Tolinski boss! Jezz man I thought you were going to be utterly famous! 87k subs, you deserve way more. So here mine!. Also, man you guys make me feel smart. I LOVE the way you talk like normal people, and dont over-complicate the lingo and technicality of concepts. You keep it straight, and btw your (at the time of writing this) Internet setup out at the cottage sounds insane!

Ответить
@FinnMckentyPRMBA
@FinnMckentyPRMBA - 17.10.2019 06:29

Wowowow blast from the past lol! It took me right back as soon as I saw that function name.

Ответить
@compteprivefr
@compteprivefr - 21.10.2019 03:31

Well, the website was surely not coded in 2006 since we got Wiz Khalifa crashing the site and instagram logos up top. THe design also look more moder than that. I'm guessing this is 2011/12

Ответить
@jasongan9589
@jasongan9589 - 29.10.2019 13:18

what a great example for JS history

Ответить
@tcelestino
@tcelestino - 02.11.2019 05:44

Dreamweaver was a first IDE to many people and everybody started to use visual editor more easier than code editor at the time.

Ответить
@fieryweasel
@fieryweasel - 20.01.2020 16:29

Ha - "wtf.js". Great video!

Ответить
@luizfelipemartino6804
@luizfelipemartino6804 - 06.03.2020 19:39

does anyone know any former macromedia engineer? would be interesting to know what these guys are doing nowadays.

Ответить
@nathancornwell1455
@nathancornwell1455 - 17.06.2020 08:36

This is where having .quokka would be nice to have lol

Ответить
@anderivative
@anderivative - 10.06.2022 10:00

BE AWARE: (I think) The browser will handle the caching of each image and not make a new request for the image when the `src` changes via `onmouseover`. BUT if you have your developer tools like Chrome Devtools open and with "Disable cache" checked, then it will make a new request per update to the `src` value via each `onmouseover`.

Maybe obvious but took my a couple hours to figure out :P

Ответить
@chmugo94
@chmugo94 - 23.06.2022 04:05

Everybody is dumping on this code and I'm literally trying to use it, but I want to manipulate the javascript and specify the full image paths in the javascript code. What I'm trying to figure out is what are you guys using in replace of it since you're laughing at it. I know jquery and haven't used angular and am wondering if there's something quicker I can use. What Im trying to do is add points on a human body and the person should be able to click on each point to identify areas that "hurt" (for massage therapy).. This is the only quick thing I could think of plus add hidden fields so I can store the values they clicked in the database.

Ответить
@RadicalBlur
@RadicalBlur - 18.03.2025 20:08

I really like looking at old websites for some reason and I've seen this script on a lot of old sites, like Sonic Team's old website for example. I looked it up to see if there's anything online about it, I'm surprised about a video? I thought I was alone looking at these things. I know nothing about javascript and I can't make sense out of what it all meant, thanks for doing the best you could explaining it

Don't really know if this is a good practice to do nowadays, I just want to swap a jpg image to another one without the flicker effect (:hover) without making it a background and having to make it's position "absolute" and manually specifying the width and height and all thattt. I think I'll figure it out eventually

Ответить

Инновационная система смыва Vincea Tornado Gidro-Top.Ru (ГИДРОТОПРУ) - сантехника, отопление и водоснабжение
Что не так с организацией продаж в 1С:Франчайзи? PRO продажи 1С. Онлайн-курсы для партнеров 1С
Отель Элеон | Сезон 1 | Серия 7 Первый развлекательный