client-side

Implementing Backbone.Subset.js in Backbone.js to filter Models from a parent Collection

谁说胖子不能爱 提交于 2019-12-04 03:00:24
In this stackoverflow post i read about filtering backbone collections and using subsets. One answer (by sled) recommends using backbone.subset.js ( usage example ). I could not find any further resources on backbone.subset.js and I failed implementing it into my project. It seems like backbone.subset.js is the perfect solution for what i'm trying to achieve. (Having one "parent" collection that holds all models at all times, and depending on user input filtering the relevant models from the parent collection into a backbone.subset collection.) My "parent" collection, holding all tasks: var

How to client-side detect when a page is bookmarked?

左心房为你撑大大i 提交于 2019-12-04 01:56:07
问题 Is it possible to detect when a page is bookmarked within the browser, using Javascript? 回答1: No, AFAIK this is not possible. 回答2: Most browsers will not let you detect when a page is bookmarked because this would be another vector for Browser History Mining exploits. If malicious code could tell what websites you've used then, for example: At best, they'd know things about you that you might wish to keep private. They could use that information to target you with embarrassing ads or to

ASP.net mvc Call Action on DropDown Value Change

扶醉桌前 提交于 2019-12-03 21:28:52
Ive got a dropdown on one of my views. This dropdown only has for entries. Basically i need to know how to call an action when the dropdown value is changed? My situation is: Im making a simple inbox page. The dropdown has the filter options: View All, View Invites, View Replies etc.. When the user selects a filter option from the dropdown I want to call to an action to return the new view with the filtered data. Any ideas? Im guessing it is somehow going to be a script attached to the OnChange of the dropdown, but i wouldnt have a clue what the syntax is or how call MVC action from the script

Render React Components from PHP

折月煮酒 提交于 2019-12-03 20:08:49
I'm using ReactJS to power a simple filterable item list and it works quite well for my need. The problem is that I need to render the markup on the server for SEO reasons, but when I call React.renderComponent() it replace the existing markup with the one generated by React. Searching in React's docs I found this note: React.renderComponent() replaces the contents of the container node you pass in. In the future, it may be possible to insert a component to an existing DOM node without overwriting the existing children. Moreover I can't use React.renderComponentToString() to generate the

Resetting visited status on links

无人久伴 提交于 2019-12-03 19:27:02
问题 Is there any way you can reset the visited status on links? The scenario is this: On an intranet-site which naturally has a lot of links we want a link to have the status of "visited" for a set period of time only. I am therefore looking for a way to manipulate the visited status of links. Is this doable? It should be cross-browser of course. ETA: Client-side solutions are perfectly acceptable. Preferred even.. :-) ETA-2: Cookies are allowed. No holds barred here :-) 回答1: Links appear as

Client side routing. How does it work?

两盒软妹~` 提交于 2019-12-03 17:31:40
问题 I need a client-side routing solution to work with a chrome app. I've researched several and crossroads.js seems like a good fit. When I include it in my html file, it doesn't seem to work; that is, if I use code like crossroads.addRoute('/news/{id}', function(id){ alert(id); }); crossroads.parse('/news/123'); , the page alerts '123' but if I type '/news/321' in the browser's url bar, it preforms the browser's default action, instead of alerting '321'. What am I doing wrong. (Also, I realize

localStorage - append an object to an array of objects

懵懂的女人 提交于 2019-12-03 16:45:45
I'm attempting to locally store an object within an array within an object. If I try the following in my console it works perfectly: theObject = {} theObject.theArray = [] arrayObj = {"One":"111"} theObject.theArray.push(arrayObj) However if I do what I think is the equivalent, except storing the result in localStorage it fails: localStorage.localObj = {} localStorage.localObj.localArray = [] stringArrayObj = JSON.stringify(arrayObj) localStorage.localObj.localArray.push(stringArrayObj) I get the following error... localStorage.localObj.localArray.push(stringArrayObj) TypeError arguments:

Server side templates, client side templates - Automatic conversion?

会有一股神秘感。 提交于 2019-12-03 12:36:34
问题 With the event of the jQuery templates plugin, I am wondering how to maintain both server-side and client-side templates. Because in my case, I have some templates, that would be duplicates - server-side as well as client-side. Just imagine this: You have a form, where you can enter list points. When you press submit, an AJAX request is generated but the entry is already showed on your page. Now, the markup for this bullet point should be the same - wether it was generated through JS or by my

Mongodb client side javascript api

时光怂恿深爱的人放手 提交于 2019-12-03 11:05:54
I would like to use mongodb directly from the client-side, using javascript inside my models. I suppose this is possible since on the mongo website there is a javascript realtime console for demo. Does exist a way to use the same api in a normal javascript application without having to write client-server glue code? Thanks Looks like the site uses REST-like AJAX interface, but I am certain that it does not access any MongoDB instance directly or even indirectly via some bridge. Thinks twice before applying this pattern: how will you enforce security? Are you aware of AJAX limitations? If you

Logic behind drag and drop

喜你入骨 提交于 2019-12-03 09:32:29
I am wondering the "how it works" and "how it should be designed and implemented" side of the basic drag & drop functionality. I have never yet implemented such a functionality. I am planning to do so for one of my projects and I do have some ideas on how to implement it. I wanted to make sure I am on the right path and that you people most probably has something to say about the matter too... Let's imagine I have 5 elements listed as following and grabbed from a database; <div id="1">this is content for 1</div> <div id="2">this is content for 2</div> <div id="3">this is content for 3</div>