Martin Kadlec blogging

userJS - Image Gallery - Alpha

Introduction

In on of the latest Opera builds we've got some new toys to play with. I'm talking about scriptStorage & -o-object-fit. So I was thinking ,what kind of user javascript I can do with that? And my first idea was an image gallery. I'm not sure if there'll be a lot of people that will actually use it, but I think that this is at least a good example of how these new features can be used. I've also used some new technologies from Opera 10.50 like 2DTransforms, Transitions and JSON. (In the new version I also use cross domain messaging.) ...

According to previous paragraph you need build 3483 or newer.

Installation

  1. So you've got good build. Now go to the URL given below and save this file into your user javascript folder:
    http://files.myopera.com/BS-Harou/files/image_gallery.js
  2. Next you will have to activate you scriptStorage by setting "User JS Storage Quota" in opera:config to higher than zero. For example 50k.
  3. The last step is to create mouse gesture or keyboard shortcut like this:
    Go to page, "javascript:opera.userjs.bsharouGallery()"

    (Or you can edit ini files and add this button:
    ButtonX, "Open Gallery"="Go to page, "javascript:opera.userjs.bsharouGallery()", 1, "Open Gallery", "Mail Newsgroups"")
  4. Now use the gesture/shortcut and black transparent box should appear on top of the page (note: this won't work on page with https protocol until you enable it in opera:config).
  5. Now you can simply drag there any images and they will stay there and will be accessible on any other site. If you want to delete some of the pictures, then just drag it out from the black box. You can create folders by right clicking on empty space of gallery and selecting the "Create folder" in the context menu.
  6. And that's it. First user javascript gallery is installed and working in your Opera.


Remember that this is alpha version so there are definitely going to be some bugs. I would appreciate if you report them in comments below. Wishes and ideas are also welcomed.

New in pre-pre alpha =)
- Opened tabs synchronization
- Folders (you can open folder by double click or in right click context menu)
- Import/Export
- Clear current folder
- Option to create PNG Icon (thumbnail) for each image (if you want to use this, you have to set big User JS Storage Quota, but then you don't have to download the image every time when you open the gallery)
- Description for images
- "Alerting" URL (the easiest one :D )

New in pre-alpha =)
- Trash
- Moving files from folder to folder (drag the image and hold it on the folder for 1s - when the folder gets lighter border, drop the image - you can move image to parent folder by dragging it to top)
- Double click o image open a new window with the image
- Longer export (>3000 characters) is opened in new window instead of alert box
- Folder names are vertically centered
- If you hold mouse on image/folder for a while it shows a bubble with URL, Size (not for local icons) and description of the image (if there is some description) or in case of folders number of images and folders inside)
- some bug fixes

New in alpha =)
- HTML/BBCode in alert dialog
- Special folder with all images on web page (not synchronized)
- New buttons next to "Hide gallery"
   - New folder (folder is created on the last position of current folder)
   - Trash (removed from right click context menu of gallery)
   - All images on web page
   - Arrange bottom/top
- Bug fixes
- Optimization

My ideas:
none

Known bugs:
- There are some Opera redraw issues, mainly when gallery is at bottom. (scrollbar, info bubble)

Comments
Please login to post comments.
Avatar
20.10.2010 20:10
Haavard said it could take several weeks or monthes... :-) And thanx!
Avatar
20.10.2010 20:10

Originally posted by InDigazzZ:

Haavard said it could take several weeks or monthes...



I wouldn't be surprised if they release it tomorrow. But it won't definitely take more than one week from now :)
Avatar
20.10.2010 16:10
it's not working here at all, but perhaps I'm doing something wrong. Can yougive me short tutorial how to use it? :)
Avatar
20.10.2010 16:10
Usage:
------------------------------
Script has to be started manually - it won't automatically show up when clicking
images.

* Create a bookmark with this address:
javascript:window.navigator.galleryUJS.run();
and run this bookmark (preferably by nickname) whenever you want to invoke the script
Avatar
20.10.2010 16:10

Originally posted by InDigazzZ:

Usage:


Thank you, I will try to find the problem this weekend, right now I'm trying to complete my opera extension before O11 release. And because I don't know when they will release it I have to hurry :)
Avatar
20.10.2010 13:10
Could you help me with this script - http://files.myopera.com/d.i.z./userjs/gallery-viewer.js?

Previously, the script works correctly, but now (I assume it's because of Opera Desktop Team - Web Sockets enter the Opera House) have to click on one of the images so they all started to boot ...
Avatar
20.09.2010 18:09
1. Mouse wheel;
2. thnx;
3. I mean, in default view - image is stretched, but when "Use local icon" is turned on - image starts keeping own ratio.
4. If image's size is less than the
size of the window (eg: avatars
on MyOpera or icons), do not stretch it to
the size of the window, and
display in accordance with its
own size. - 4.
Avatar
20.09.2010 17:09

Originally posted by InDigazzZ:

Scroll speed should be increased.



you mean with mosuewheel or with draged image on the side?

Originally posted by InDigazzZ:

2. Ability to transfer all images in a folder (like CTRL + A and move into folder).


too complciated, but you can use export/import feature to do that.

Originally posted by InDigazzZ:

default
local icon used


Creating local icon is very complex process because of some opera security reasons, so it might really decrease speed.
Avatar
20.09.2010 15:09
1. Scroll speed should be increased.
2. Ability to transfer all images in a folder (like CTRL + A and move into folder).


default

local icon used
Avatar
18.09.2010 14:09
New (alpha) version uploaded. Changes are in the blog post.

There is lots of Opera redraw bugs when gallery is at bottom.
If you want to help then try to convince Opera developers to fix bug DSK-313540. ( http://bit.ly/9Y2viG )
Avatar
10.09.2010 13:09

Originally posted by InDigazzZ:

Appearance: Top - Bottom - Right - Left


If there won't be too much problems with it I will try to add it =)

Originally posted by InDigazzZ:

Ability to stretch the area.


This would be probably very difficult.

Originally posted by InDigazzZ:

What about SlideShow?


decisions decisions...
Avatar
10.09.2010 07:09
Appearance: Top - Bottom - Right - Left
Ability to stretch the area.

What about SlideShow?
Avatar
09.09.2010 15:09

Originally posted by InDigazzZ:

. functional from http://files.myopera.com/d.i.z./userjs/gallery-viewer.js with saving data to Gallery



Perhaps in the far future

Originally posted by InDigazzZ:

2.1 Creating folder where name is page's title



Titles are often very long for folders Names

Originally posted by InDigazzZ:

3. Alert URL as menu with:


I will add this in next version =)
Avatar
09.09.2010 07:09
1.
2. functional from http://files.myopera.com/d.i.z./userjs/gallery-viewer.js with saving data to Gallery
2.1 Creating folder where name is page's title
3. Alert URL as menu with:
~ Alert URL
~ Alert URL as BB-code
~ Alert URL as HTML-code
Avatar
08.09.2010 18:09
I've uploaded new version (pre-alpha). You can see the list of news in the blog post =)
Avatar
07.09.2010 15:09

Originally posted by BS-Harou:

In new version you can Open the image with double click =)


i can't - double click on image and nothing happens

Wishes:
1. "On/Off local icon" enable turning on/of for folder not only for each image;
2. moving images/folder into another folders
Avatar
07.09.2010 15:09

Originally posted by InDigazzZ:

i can't - double click on image and nothing happens



I mean in new version I'm working on. I will probably release this new version this week =)

Originally posted by InDigazzZ:

2. moving images/folder into another folders


Working in new (unreleased) version

Originally posted by InDigazzZ:

1. "On/Off local icon" enable turning on/of for folder not only for each image;


Good idea =)
Avatar
07.09.2010 15:09

Align text in the center and, if possible, transfer lines.
Avatar
07.09.2010 15:09

Originally posted by InDigazzZ:

Align text in the center and, if possible, transfer lines.



That is in known bugs...
Avatar
07.09.2010 15:09
like this...
Avatar
07.09.2010 15:09

"local icon"'s icon should be more expressive - a little bigger and can yellow or red
Avatar
07.09.2010 15:09

Originally posted by InDigazzZ:

"local icon"'s icon should be more expressive - a little bigger and can yellow or red



I tested a lot of different colors and sizes and this is what I choose after half an hour of testing. On dark images is the white dot visible, and on light images is the black border visible. Any other color might blend in with the image. I agree that the size should be bigger, but then it looks really weird when there is a lots of big dotes)

Anyway you can edit the userJS file and change those lines:
cont.fillStyle = "rgba(255,255,255,0.8)"; // fill color
cont.strokeStyle = "rgba(0,0,0,0.8)"; // border collor
cont.arc(6+l,6+t,2,0,360*(Math.PI/180),false); // the third parameter "2" is the radius of the circle.
Avatar
07.09.2010 14:09
1.

1. Open image;
2. Open gallery;
3. Right Click.

2.
Sometimes folders are created only with the second / third time ...

Wish - If you want to delete some of the pictures, then just drag it out from the black box. - It is better to open the image. "Open image" in the context menu too complicated

3. Thumbnails for folders
Avatar
07.09.2010 14:09

Originally posted by InDigazzZ:

Wish - If you want to delete some of the pictures, then just drag it out from the black box. - It is better to open the image. "Open image" in the context menu too complicated



In new version you can Open the image with double click =)

Originally posted by InDigazzZ:

3. Thumbnails for folders


Sorry, I won't do that - that would make lots of troubles.
Avatar
07.09.2010 14:09

Originally posted by InDigazzZ:

1. Open image;
2. Open gallery;
3. Right Click.



Thanks for this one, I'll try to fix it =)
Avatar
03.09.2010 15:09
It seems , in a short time a gallery like Coolirish will be available with your studies :)
Avatar
03.09.2010 15:09

Originally posted by ZAHEK:

It seems , in a short time a gallery like Coolirish will be available with your studies



Well I don't plan to do much improvement now. There are only few things I will add and then I will focus on bug fixing. And I hope that at least someone will use it =)
Avatar
03.09.2010 14:09

Originally posted by InDigazzZ:

i want to try



I've updated the post and on the URL is the new version =)

If you find any bug that is not in known please let me know
Avatar
03.09.2010 05:09

Originally posted by BS-Harou:

I've got something like pre-pre-alpha RC1 with about thousand of bugs. Do you want to try it or should I fix more bugs first?



i want to try
Avatar
02.09.2010 20:09
I've got something like pre-pre-alpha RC1 with about thousand of bugs. Do you want to try it or should I fix more bugs first?

News:
- Opened tabs synchronization
- Folders
- Import/Export
- Clear current folder
- Option to create PNG Icon (thumbnail) for each image (if you want to use this, you have to set big User JS Storage Quota, but then you don't have to download the image every time when you open the gallery)
- Description for images
- "Alerting" URL
Avatar
22.08.2010 21:08
Avatar
21.08.2010 20:08
Wow. It's amazing. Does it have any limitation such as 50kb image size or 100 images?
Avatar
21.08.2010 20:08

Originally posted by greench:

Wow. It's amazing. Does it have any limitation such as 50kb image size or 100 images?



It actually stores only url of images. Anyway its limited only by the number you set in opera:config

Originally posted by BS-Harou:

This is a great idea. It is still a bit buggy, but when it gets ready I believe it will be useful.


The worst bug is the lines that it leaves behind when you close it - the problem is that this is bug of opera :/
Avatar
21.08.2010 19:08
This is a great idea. It is still a bit buggy, but when it gets ready I believe it will be useful.