I am working on an application with basic authentication functionality. When a user registers, I would like to display a javascript lightbox message containing a brief introduction to the application. Additionally, I would like to display notifications when a user logs in after a set time span (1 week, 1 month, etc). I'm not sure flash notifications will suffice as I plan on having slightly complex html in the messages, with forms/links/etc. I can think of a number of hacky ways to accomplish this, but none of them seem elegant and robust.
Any ideas?
You can just keep track of the login count and when it's their first login just activate the lightbox.
if current_user.sign_in_acount == 1
# render welcome lightbox
end
if current_user.created_at > 1.week.ago && not_notified?
# render notification lightbox
end
There won't really be an out of the box solution or anything and since you have two different types of scenarios for messages(time vs. login count) it's something you can just do for the small amount of times you are going to have to do it.
Maybe append a special parameter at the end of the URL after the user registers, and have JavaScript check for it? So after registration, send user to /whatever_page?just_registered, and have some JS code to check that.
if(window.location.search.test(/just_registered/)){
// pop up lightbox
}
Or you can just do a temporary cookie, set it, let Javascript check it, show the lightbox and delete it right away. You can do something similar with the display notification thing.
Related
I'm kind of a beginner to WIX Code. I have this site which I have made i.e www.rat-store.com. I am facing three problems which I know might get solved with some code but I don't know how to do it. Here are the problems:
In manual payment, I need to accept some form input from the user on a page and only if the user agrees to the terms and enters the correct date should the submit button get activated following which an otherwise collapsed image should also reveal (it's the QR code to make payment; Image 1) (www.rat-store.com/manual-pay-rat)
Image 1
I'm trying to link a repeater background to a page but it's not working. I have to create a button inside the repeater to do this. Any workarounds? I know an image will work but the thing is that the motive is to create a kind of a list which will keep on incrementing in the future and I can't just keep on drag-dropping images, text and then group them up and link. (Image 2) (www.rat-store.com/shop-by-events)
Image 2
Since WIX Stores doesn't have an inbuilt cancellation feature I built a form to substitute for the same but I want that no two same order cancellations are submitted i.e. a customer can only submit his/her cancellation request for a particular order number once. The next time s/he tries to do that it should show that the request already exists. (Image 3 and Image 4) (www.rat-store.com/cancel-orders)
Image 3
Image 4
Some help with the code and approach would really be great. I'm almost finished with my site; Only these last few things bother me. I'm attaching a screenshot of each page, serially w.r.t the question number. P.S: The order number is the number generated for each order by the Wix store app itself. I have nothing to do with that. The customer needs to enter his/her number and if that is valid we will process the request. Apologies for the length of the post.
I looked on SO, here, a few other places & ... cluelessness set's in.
What is the structure of the Facebook " Like " Button found all over websites ?
Is it a Social Bookmarking, Browser Button kind ?
Is there a step by step process (without using FB Api) to make my own kind of button.
How to design & implement a Like Button ?
I want my own button with similar functionality as FB but NOT related or developed on their platform! I am trying to input this in iWeb'09 as a html widget.
I've done this successfully. Here's how i did it:
You have a table in a database called "likes" with fields username,postid (and date, id if you want too)
Each post/blog/article should have its own id.
When someone likes a post/blog/article, you take the id of the post/blog/article and the username who liked it and check the likes database to see if it already exists. If it already exists, you remove the like. If it does not exist you add a like.
For example with AJAX, this is how i did it specifically:
I have a blog post with id 6.
Jonathan likes this post.
These 2 variables are sent via a post form and wait for a response, likes logic checks database to see if this record already exists in likes table (username,postid) values ('Jonathan', 6) if the response is 1 (or true), then i update the div number for the likes button from whatever value was there originally and add 1. If the response is 0 (or false) then i take the original value in the likes counter and remove 1.
To answer your question consider what happens with buttons and then go into like buttons.
Pressing a button triggers an event on client which may or may not update a server somewhere to notify that a button has been pressed for such and such intention. You can send a lot of extra info with this event like when and where who and why etc
Like buttons usually have extra info on who liked it and what they like. In order to get that you might ask people to sign in or provide some kind of input to identify them.
Take a real world example of a like button you can implement in say javascript using any server side technology
Whoever install your script will be able to see the button. You may form it with any css or your javascript can simply load an iFrame from your server or append elements to DOM to show this button
When clicked it calls your server with person's info or at least the page url where it was called. For example google analytics uses a unique ID associated with domain url to track visitors.
when you recieve this call you can update your database/storage or anything with the tick mark that button on abc site has been pressed so lets update their likes or dislikes.
If you want your javascript can also increment the number on the same page either before or after updating your server.
When someone else visit that site the script again loads and send a request to your server so you can update the count on page but this time user does not click on like/dislike button so you dont update the record.
You may then show it as a pie chart to user on total visits to their site or page with division in people who liked it and people who did not report back (did not press the button)
If you are still wondering how you can create a button . Use CSS button generator to get one
You must first have a database where you can store various values.
Now, Whenever the user clicks the button, the value of the button stored in the database must be incremented. For this, you will need a backend language which connects you to SQL database.
So whenever the button has clicked the value of the likes in the database changes.
I am wondering how to make a JavaScript popup message (display for 5 seconds) when a database input for specific users have changed? Kind of like the Xbox live achievement message that comes up each time you do a specific task, but i want mine to check if the level for a specific user changes and then have a popup message saying "Congratulations on reaching level x". I'm going to have a popup message for other things than just level as well so it would need to be easy to design.
I couldn't find anything online so if any of you have any suggestions, please leave me some links.
either use a timer and ask via ajax in an interval for new popups
or use websockets/websocketserver to push that info to the client
I am trying to manipulate Facebook pages in various ways, using Javascript browser elements. I'd need to be able to insert some text into the top "Type something..." box that shows on my site's fan page (or alternately, "click into" the field and I can type the text using GUI scripting), then click the "submit" button as if i'd done it by hand. It's tricky since the page is very Ajax heavy and I can't find the names of the elements I need to manipulate, let alone how to manipulate them as they're not using traditional form fields I'm used to. Can anyone help me figure out how to do this with javascript commands, which I'd be calling from Applescript on the Mac?
Many thanks in advance.
UPDATE
Thanks for the comments below. Believe me, I am not trying to do anything spammy or douchy, mainly posting links to products that have gone live on page facebook page, but do it during the business day when people are on rather than at strange hours of the day. I am located in Japan so my sleep period is right when people are using FB.
The solution I came up with for clicking the button was got using UI Browser, an outstanding tool if you're trying to script on the Mac. The script that clicked the button for me was:
tell application "Safari"
activate
set thename to name of (get current tab of window 1)
delay 3
tell application "System Events"
tell process "Safari"
try
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 3 of window thename -- this one works on the mini?
on error
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 2 of window thename -- did not work
end try
end tell
end tell
end tell
Hope this is useful to anyone.
You can't. But even if you could you want to post comments on peoples behalf and expect them to continue using your site...
It would be cross site scripting - and since the comment box is in an iFrame it actually exists on Facebook's site and not your site.
Manipulating web pages for functionality is rarely a good idea, since you can introduce bugs and security flaws.
In this instance, if all you want to do is post a status, just use the Facebook API thats what its there for. They provide libraries (I think, at the very least they are available) to make it easy to use whatever language you want.
From a UX PoV, people don't like being forced to post things, so if this is just for your use, then fine, otherwise, make sure that people know whats going on. Its only polite.
Is there a Javascript library (preferably a jQuery plugin) or simple mechanism to check if a visitor is idle? For example, if the visitor to a webpage has been there more than 5 minutes only moving their mouse but not clicking any buttons or pressing any keys, then call a particular Javascript function.
It seems like I could just call setTimeout() for my desired idle time and then call clearTimeout() upon any mouse click or keyboard press by having something like $('body').click(clearTimeout(.... But I'm sure there are issues I don't want to have to figure out. The one thing I definitely don't want to have happen is for my site to think someone's been idle and they haven't really been. The other way around is ok.
Yes, very possible and there are a couple sites that use this (like banks and Mint) with great success. Take a look at these two blog posts:
http://www.erichynds.com/jquery/creating-a-mint-com-style-idle-logout-timer-using-jquery/
http://www.erichynds.com/jquery/a-new-and-improved-jquery-idle-timeout-plugin/
I have used this approach in the past with Admin pages within websites to a fair amount of success, especially after adding the modal dialog box informing users that the session was about to expire. This helps the user to feel like the web application/site is working with them to help.