On Dom Change through JS functions, update URL - javascript

I tried searching for any questions on StackOverflow that fit this and I believe that I am probably not using the proper language (phrasing the question properly) to pull up those questions. So I apologize if this is a repeat.
I currently am building a site with a high level of DOM changing through JS. Not exactly the best thing to use but works based on my technical skills. I had thought about using AngularJS to build out my project but there is a steep learning curve that is preventing me from making the switch. I did notice that AngularJS has a built in function that generates fake urls based on the data being pulled. Even though the user is not leaving the viewer the url updates to highlight the new information. I was wondering if their was a JS library that could replicate that function until I can pick up AngularJS and rewrite my code in it.
Thank you

Found a few that do what I need. I can't also figure out how to make a comment the accepted answer.
http://millermedeiros.github.io/crossroads.js/
https://github.com/tildeio/router.js/

Related

jQuery UI : When to use Widget Factory

I'm a beginner in Javascript and web development in general. I'm building a web app that must be highly interactiv, so most of my work is about using Javascript to make this happen.
After having already written a good chunk of code, I feel like it won't be really maintainable and it's already hard to change, because I don't think I organised my code very well.
Essentially, I'm looking to separate the code that does actions on my objects, and the code that displays my objects. I've found that the Widget Factory might be a way to do that, but I can't really understand what it does exactly.
I red lots of documentation on it, but I don't know if it will be of any use for what I want to do.
Can you tell me if it will be useful for me, and if not, what other tools or tutorials I should get my hands on to achieve this ?
Thank you
The widget factory is used to define custom jQuery widgets.
Your questions is very broad and generic to answer, since only you know what kind of objects/models and what kind of interactivity you are expecting to have between clients and the page.
In general you should create widgets when you are implementing a generic solution.
A widget is meant to be something re-usable that handles one particular think/job.
For example if you want a "rate this comment" thingy in your page were users can rate other user's comments, you would create a rate-comment widget and apply it to all your user-comment elements.

Lock out part of the code so nobody except the desired developers can modify it

We have an angular application that contains a controller that we need to keep "private" so nobody except the developers in charge can actually change that code.
The rest of the team should be able to use that part without being able to modify it, but they should be able to modify the rest of the application.
Do you guys know if there is a way to do that?
EDIT: Using VCS is one possible solution, we use GitHub, I need to find a way of checking that the source is not modified. Sorry for the lack of information in the original question.

Data layer for existing JS project

We have a big project with big amount of front-end code + jQuery.
I would like to have a library to implement into existing project which would let me handle data in a friendly way.
Most annoying thing which happens now is this:
1. grab some data from DOM element. Modify it a bit, filter it.
2. send AJAX with that data.
3. receive AJAX.
4. filter AJAX. Modify it a bit.
5. update DOM with new received modified data.
This can be really automated and I believe there are ways to do so however from my experiments backbone.js, angular.js, ember.js and similar libraries do not work very well in my case as it is too hard to imlement them into existing project. When starting from scratch - they are awesome in my opinion.
I have read about implementing only new parts in them but this seems not to be the case as
I would like to improve existing code.
What I would like - some lightweight module on top of jQuery maybe which would handle these things for me in a more friendly fashion.
Why downvotes?
I am not starting a flamewar, asking for open question or so. I am asking for a tool for a problem. Downvoter - at least give your insight what's wrong with the question.

Does AngularJS offer advantages for a simple AJAX website

I have made a simple site which I now want to add a javascript overlay to do some relatively simple things such as:
Make the search box and pagination ajax driven to results can be loaded in without a refresh
Integrate the HTML5 history system
Add form validation
My coder has told me that I should use angular over jquery. When I look into it, it seems Angular is designed for large, completely AJAX driven sites, and ends up using jquery or jquery lite anyway.
My question is, does angular offer any significant advantages for my use case, to counteract the disadvantage of the learning curve and lack of community.
In my opinion there is no point for you to get hands dirty with AngularjJS for one small and rather simple project.
If you plan to extend your website in near future and continuously add new features than it is something to consider along many other options.
The beauty of AngularJS from what I've seen so far is that it's easy enough to drop into any project regardless of size. I've made a simple application like you described and it was still faster than just avoiding it all together.
We have been using Angularjs and saw that it saves much time of us in comparision with jQuery.
Angularjs uses Declarative programming for processing UI. It means that you only
need to declare your UI logic, Angularjs will process it for you.
See this link please: ANGULAR PHILOSOPHY
Now we still use jQuery in some cases but Angularjs is our top priority.
I advice you to learn and use it now.

does it make sense to use something like backbone for a single page application created using Raphael?

For the past six months or so I've been teaching myself Javascript by building a single page application that uses Raphael to create all of the elements the user sees and interacts with (see the landing page for the project for a small-scale example of what the tool will do). As I've been learning more about the language I've been coming across a lot of talk about using something like Backbone to structure the code such that it will be easier to read and maintain. While I'm not in love with the idea of taking what I've written and shoehorning it into an MVP paradigm (which would also require me to learn the paradigm), I am in favor of writing quality code that won't cause me headaches later. However, in the course of doing some google research, I've discovered that backbone doesn't seem to play nicely with SVG elements. True, there are some workarounds posted, but it seems to me that if I have to implement a kludgey work-around in order to get everything to work, the value of implementing Backbone in this case is lost as my code is still wonky, albeit in a different way. (ego compels me to point out that as it stands, the code is reasonably un-spagettified)
Given that I'm relatively new to Javascript, and to serious web programming in general, I'm posting this question here in the hopes of soliciting advice from persons more learned than I in matters such as these. If you were in my position, would you implement Backbone (or some equivalent) or would you proceed without it?
I would suggest you keep doing what you are doing. The website looks good and responsive. Do not change anything as long as you think the code is easily maintainable and readable. When you see heavy loading and spaghetti code, then you might consider about using some JS structure.

Categories