Search Results

Search found 7724 results on 309 pages for 'backbone js'.

Page 39/309 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • angular js scope property is undefined

    - by user2071301
    why is $scope.orderBy undefined? Shouldnt it be "test" ? http://jsfiddle.net/XB4QA/4/ var app = angular.module("Foo", []); app.directive("two", function () { return { scope: { orderBy: '@' }, restrict: 'E', transclude: true, controller: function ($scope, $element, $attrs) { console.log($scope.orderBy); // is undefined, why? }, template: '<div></div>', replace: true }; }); <div ng-app="Foo"> <two order-by="test">test</two> </div>

    Read the article

  • Web Standards alternatives to Flex/Silverlight (I mean serious alternatives, not just JS framewoks)

    - by user252160
    Is there a set of open standards technologies that I can use to achieve the same way of development as in Flex and Sivlerlight? I am talking about componentization, separation of concerns, rich graphics, states and effects . Please point out some tutorials and other resources if possible. P.S. I KNOW that this is technically possible, so please do not respond by sending google search results or general JQuery tutorials. I've seen those already. I need to know how a Flex / Silverlight developer could design and implement an application in roughly the same way (imagine a rich HTML tag set, much like XAML/MXML, behind which stands JavaScript responsible for handling events and business logic. Think also about binding)

    Read the article

  • How can I inject Javascript (including Prototype.js) in other sites without cluttering the global na

    - by Daniel Magliola
    I'm currently on a project that is a big site that uses the Prototype library, and there is already a humongous amount of Javascript code. We're now working on a piece of code that will get "injected" into other people's sites (picture people adding a <script> tag in their sites) which will then run our code and add a bunch of DOM elements and functionality to their site. This will have new pieces of code, and will also reuse a lot of the code that we use on our main site. The problem I have is that it's of course not cool to just add a <script> that will include Prototype in people's pages. If we do that in a page that's already using ANY framework, we're guaranteed to screw everything up. jQuery gives us the option to "rename" the $ object, so it could handle this situation decently, except obviously for the fact that we're not using jQuery, so we'd have to migrate everything. Right now i'm contemplating a number of ugly choices, and I'm not sure what's best... Rewrite everything to use jQuery, with a renamed $ object everywhere. Creating a "new" Prototype library with only the subset we'd be using in "injected" code, and renaming $ to something else. Then again I'd have to adapt the parts of my code that would be shared somehow. Not using a library at all in injected code, to keep it as clean as possible, and rewriting the shared code to use no library at all. This would obviously degenerate into us creating our own frankenstein of a library, which is probably the worst case scenario ever. I'm wondering what you guys think I could do, and also whether there's some magic option that would solve all my problems... For example, do you think I could use something like Caja / Cajita to sandbox my own code and isolate it from the rest of the site, and have Prototype inside of there? Or am I completely missing the point with that? I also read once about a technique for bookmarklets, were you add your code like this: (function() { /* your code */ })(); And then your code is all inside your anonymous function and you haven't touched the global namespace at all. Do you think I could make one file containing: (function() { /* Full Code of the Prototype file here */ /* All my code that will run in the "other" site */ InitializeStuff_CreateDOMElements_AttachEventHandlers(); })(); Would that work? Would it accomplish the objective of not cluttering the global namespace, and not killing the functionality on a site that uses jQuery, for example? Or is Prototype too complex somehow to isolate it like that? (NOTE: I think I know that that would create closures everywhere and that's slower, but I don't care too much about performance, my code is not doing anything that complex)

    Read the article

  • can you explain this jquery method from jquery.js

    - by mrblah
    Trying to understand how jquery works under the covers, what's the difference between: jQuery.fn and jQuery.prototype jQuery = window.jQuery = window.$ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, and then: jQuery.fn = jQuery.prototype = { init: function( selector, context ) {

    Read the article

  • While Mouse press event. Prototype JS or Javascript

    - by nahum
    Hi, I would like to know if someone knows how to make a function repeat over and over while the mouse is press, I don't know how to make it work. I know in prototype you can take events like $('id').observe("click",function(event){}) $('id').observe("leave",function(event){}) $('id').observe("change",function(event){}) //etc... but is something like $('id').observe("whilemousepress",function(event){}) :P //I know there is not any event in javascript but I would like to emulate. thanks...

    Read the article

  • Issue with Facebook JS API, revokeAuthorization

    - by BBonifield
    I am trying to integrate FB connect into our user profile screen. Although, I'm having an issue with FB.ApiClient.revokeAuthorization. http://pastie.org/921942 The basic problem is that I revoke the auth at line 44 after the user clicks the disconnect button. After that, all subsequent API calls don't have a valid session to even check user status. I've tried wrapping blocks in a FB.Connect.forceSessionRefresh block, but then the code will never be called at all. I'm not sure what the proper workflow should be for this purpose. Right now it's basically... User arrives at profile NOT connected to the application. User clicks on the connect button. Once connected, DOM manipulation occurs to hide the connect button and add in a disconnect button. User clicks on the disconnect button. User's authorization to the application is revoked and (it seems) the API session to the FB server is invalidated. DOM manipulation occurs to hide the disconnect button and readd the connect button. User clicks on the connect button. Once connected, the FB.Connect.get_loggedInUser() don't return the actual user.

    Read the article

  • Colour manipulation of custom tags in niceEdit HTML editor ( JS / DOM )

    - by Chris
    Hi, I would like to be able to highlight, during typing and in real time, certain custom tags in the format #tag_name# within the text of a nicEdit instance ( http://nicedit.com/ ). My current attempt to implement as close to this as possible revolves around using the blur event of the editor to highlight the tags once the editor loses focus. I then use the following logic to wrap the tags in a span with a highlight class.. htmlEditor.addEvent( "blur", function( ) { str = nicEditors.findEditor( "html_content" ).getContent( ); // Remove existing spans first, leaving just the tag ( this could mess up if the html has been edited directly ) str = str.replace( /(<span class=\"highlight\">)(.[^<]+)(<\/span>)/gi, "$2" ); // Then wrap all instances of a particular tag with the highlight span str = str.replace( /#tag_name#/gi, "<span class='highlight'>#tag_name#</span>" ); nicEditors.findEditor( "html_content" ).setContent( str ); }); This is not ideal as my actual text now contains unwanted spans ( I only want the highlighting for the user's input experience, not to be saved to the database ). Obviously I could remove the spans before saving the text but the whole system is currently open to errors ( If the html is directly edited then other text may get highlighted etc ). What I would like to know is.. Is there any way to directly change the colour of the tags in the editor or DOM without using a mechanism such as this? Perhaps a way of colouring the text in memory rather than changing the HTML ? Any ideas ? Regards Chris P

    Read the article

  • JS settimeout doesn’t work in IE8…

    - by Nagesh
    <html> <head> <script> var i; i = 0; function loop() { i = i + 1; alert(String(i)); setTimeout("loop()",1000); } setTimeout("loop()",1000); </script> </head> <body> </body> </html> Please try the above code in IE8 it will not give alert message for every 1 sec if you hold right click. But in firefox it will give alert message even though if you dont release the right click. I want the firefox functionality in IE8.

    Read the article

  • YUI (JS): Putting a MenuBar in a Panel

    - by John Bentley
    If I put a YUI menu bar in the body it works perfectly. However if I use it inside of a Panel it shows up without the proper background. It is larger than it should be. Other than the default sam skin I'm using only the following css. .windowbody is the class of the panel. <style type="text/css"> body { margin: 0; } .windowbody { overflow: auto; padding: 0; } .windowbody div { padding: 0; margin: 0; } </style>

    Read the article

  • VS2010 Build Definitions - Creating a MSBuild task for JS/CSS Minification

    - by RPM1984
    Hi guys, We've recently upgraded from VS2008 - VS2010 (and hence upgrading from Web Deployment Project to proper deployment templates). Alas - my Workflow skills arent quite up to scratch. Previously, we used a MSBuild task to execute the Yahoo YUI Javascript/CSS compression module to minify/compress javascript and css files. Anyone manage to accomplish this task with Visual Studio 2010 / TFS 2010 ?

    Read the article

  • Implementing a State Machine in Angular.js to control routing

    - by ldn_tech_exec
    Can anyone help me with integrating a state machine to control routing? What's the best method to do this? Create a service? I need to basically intercept every $location request, run the state machine and let it figure out what the next $location.path should be. Think of the problem like a bank of questions that get added and removed over time. The user visits once in a while, passes in the user's answers object to the statemachine, and the statemachine figures out which question to load. This is my pseudocode, but i need to figure out where to put this or what event I can hook into to make sure all route requests are passed through the machine. Do I need a specific stateMachine controller? Do I create a service? Where do I use the service? Do I need to override $locationProvider? $scope.user.answers = [{ id: 32, answer: "whatever" }, { id:33, answer: "another answer" }] $scope.questions = [{ id:32, question:"what is your name?", path:"/question/1" },{ id:34, question:"how old are you?", path:"/question/2" }] var questions = $scope.questions; angular.forEach(questions, function(question) { if(question.id !exist in $scope.user.answers.id) { $location.path = question.path break; }); Thanks

    Read the article

  • Several xml errors using Facebook JS SDK with xhtml strict

    - by Landitus
    I'm trying to set up some like buttons to a project. These buttons live inside a jquery slideshow with Aino's Galleria and let you "Like" each different slide. I'm using an xHTML strict document and while in Firefox (and Firebug) everything seems ok, but in webkit inspector I get this: XML self-closing tag syntax used on <fb:like>. The tag will not be closed. [The HTML that caused this error was generated by a script.] XML self-closing tag syntax used on <fb:like>. The tag will not be closed. I get one of these every slide, so there are 28 errors. Looking into it, found some seem to enclose the fb:like into something like this: <script type="text/javascript"> //<![CDATA[ document.write('<fb:like href="<?php echo "http://www.site/image-".$image_id ;?>" width="260" height="80" show_faces="false" />'); //]]> </script> The above, still works in Firefox, but not in Safari. The inspector says: 26 XFBML tags failed to render in 30000ms. Moreover, for the Facebook like buttons to work with the Galleria Jquery plugin, I have a custom function that reloads only the facebook like button concerning the actual slide which appears briefly upon loading the slide: [...] extend: function(options) { // listen to when an image is shown this.bind(Galleria.IMAGE, function(e) { number = e.index + 1; tag = $('.galleria-info-description .info-box-'+number).find('.btn_fb'); $(tag).each(function() { FB.XFBML.parse( this ); }); }); } This thing is getting more complex and really don't know who is causing the problem! Hope somebody can help or ask the right questions!

    Read the article

  • How do i fix this JS scope in GM_xmlhttpRequest

    - by acidzombie24
    When i run this code alert 2 shows 6 different href links. alert 3 shows the last href 6 times. How do i make it use the same object (linkdom aka thelink) as alert 2. NOTE: This is in a greasemonkey script { var linkdom = thelink; alert('2' + linkdom.getAttribute("href")); GM_xmlhttpRequest({ method: 'GET', url: href, onload: function(resp){ //... alert('3' + linkdom.getAttribute("href")); } }); //... }

    Read the article

  • JS Object this.method() breaks via jQuery

    - by Peter Boughton
    I'm sure there's a simple answer to this, but it's Friday afternoon and I'm tired. :( Not sure how to explain it, so I'll just go ahead and post example code... Here is a simple object: var Bob = { Stuff : '' , init : function() { this.Stuff = arguments[0] } , doSomething : function() { console.log( this.Stuff ); } } And here it is being used: $j = jQuery.noConflict(); $j(document).ready( init ); function init() { Bob.init('hello'); Bob.doSomething(); $j('#MyButton').click( Bob.doSomething ); } Everything works, except for the last line. When jQuery calls the doSomething method it is overriding 'this' and stopping it from working. Trying to use just Stuff doesn't work either. So how do I refer to an object's own properties in a way that allows jQuery to call it, and also allows the object to work with the calling jQuery object? i.e. I would like to be able to do things like this: doSomething : function() { console.log( <CurrentObject>.Stuff + $j(<CallerElement>).attr('id') ); } (Where <CurrentObject> and <CallerElement> are replaced with appropriate names.)

    Read the article

  • Full Width Divs using ScrollTo.js

    - by David Haigh
    This is my first ever post. I am using the ScrollTo jQuery plugin and i have stumbled across a problem... I have 6 rows, each with 6 child divs , I would like each of these child divs to be full width. The plugin works great but I cannot seem to get the child div to be full width (then use ScrollTo to 'slide' to the next div, or to a div on the next row. ) Here is my code: http://jsfiddle.net/RZjrV/ Is it even possible? I have set body - Overflow:hidden to avoid any initial confusion. Thank you all who read this post and even take a minute to think about it. David

    Read the article

  • JS sort works in Firefox but not IE - can't work out why

    - by Max Williams
    I have a line in a javascript function that sort an array of objects based on the order of another array of strings. This is working in firefox but not in IE and i don't know why. Here's what my data looks like going into the sort call. (I'm using an array of three items just to illustrate the point here). //cherry first then the rest in alphabetical order originalData = ['cherry','apple','banana','clementine','nectarine','plum'] //data before sorting - note how clementine is second item - we wan to to to be after apple and banana csub = [ {"value":"cherry","data":["cherry"],"result":"cherry"}, {"value":"clementine","data":["clementine"],"result":"clementine"}, {"value":"apple","data":["apple"],"result":"apple"}, {"value":"banana","data":["banana"],"result":"banana"}, {"value":"nectarine","data":["nectarine"],"result":"nectarine"}, {"value":"plum","data":["plum"],"result":"plum"} ] //after sorting, csub has been rearranged but still isn't right: clementine is before banana csubSorted = [ {"value":"cherry","data":["cherry"],"result":"cherry"}, {"value":"apple","data":["apple"],"result":"apple"}, {"value":"clementine","data":["clementine"],"result":"clementine"}, {"value":"banana","data":["banana"],"result":"banana"}, {"value":"nectarine","data":["nectarine"],"result":"nectarine"}, {"value":"plum","data":["plum"],"result":"plum"} ] Here's the actual sort code: csubSorted = csub.sort(function(a,b){ return (originalData.indexOf(a.value) > originalData.indexOf(b.value)); }); Can anyone see why this wouldn't work? Is the basic javascript sort function not cross-browser compatible? Can i do this a different way (eg with jquery) that would be cross-browser? grateful for any advice - max

    Read the article

  • Issue editing class style properties using js - issue is with IE

    - by Nick
    I have a function to edit the style properties of a class Unfortunately IE does not seem to like it but it does not give me an error. Does anyone know what the issue is? Thanks in advance function myRemoveElement(id) { var Node = document.getElementById(id); Node.parentNode.removeChild(Node); } function boolyChangeFoo(width1, width2, width3, width4) { if(typeof style == 'undefined') { var append = true; myStyle = document.createElement('style'); } else { while (myStyle.hasChildNodes()) { myStyle.removeChild(myStyle.firstChild); } } if (document.getElementById('my_custom_styles')) { myRemoveElement('my_custom_styles'); } var head = document.getElementById('myltd_popup_1'); var rules = document.createTextNode('.my_price_comp_inner { width: ' + width1 + '}' + '.merch_coupons_summary { width: ' + width2 + '}' + '.merch_coupons_data { width: ' + width3 + '}' + '.my_coupon_prod_item { width: ' + width4 + '}' ); myStyle.setAttribute('type','text/css'); myStyle.setAttribute('id', 'my_custom_styles'); if(myStyle.styleSheet) { myStyle.styleSheet.cssText = rules.nodeValue; } else { myStyle.appendChild(rules); } //alert(myStyle); if(append === true) head.appendChild(myStyle); }

    Read the article

  • Need help with cycle in JS

    - by antiarchitect
    I have such function, that adds a grid of droppables: function AddClassroomDrops(grid, weeks, days, times) { for(week = 1; week <= weeks; week++) { for (day = 1; day <= days; day++) { for (time = 1; time <= times; time++ ) { Droppables.add('container_grid'+ grid + '_week' + week + '_day' + day + '_time' + time, { accept: 'pair', hoverclass : 'hovered_receiver', onDrop: function(pair, receiver) { new Ajax.Request( '/pairs/'+pair.id+'/update_on_drop', { method : 'put', parameters : { classroom : grid, week : week, day : day, time : time, container : receiver.id } } ); } }); } } } } The problem is that params of Ajax.Request (week, day, time) are always equal to weeks + 1, times + 1, days + 1. But they must vary according to the cycle.

    Read the article

  • Open source / commercial alternative for jiffy.js?

    - by Marcel
    Hi, we'd like to measure "client side web site performance". i.e. we would like to have answers to the following questions: how long did it takt to load and render a webpage (including alle graphics scripts etc.) this bundled with additional informations like user-agent, operating system etc. a graphical tool to analyze the data would be perfect I know jiffy ( http://code.google.com/p/jiffy-web/wiki/Jiffy_js ) but that isn't maintained anymore. I would prefer either a hosted solution (like google analytics) or a java based solution that we deploy for ourselves. Do you know something like that? Thanks, Marc

    Read the article

  • Client/JS Framework for "Unsaved Data" Protection?

    - by Kevin Dostalek
    Hey all- we have a typical web application that is essentially a data entry application with lots of screens some of which have some degree of complexity. We need to provide that standard capability on making sure if the user forgets to click the "Save" button before navigating away or closing their browser they get a warning and can cancel (but only when there is unsaved or dirty data). I know the basics of what I've got to do-- in fact I'm sure I've done it all before over the years (tie in to onbeforeunload, track the "dirty" state of the page, etc...) but before I embark on coding this YET AGAIN, does anyone have some suggestions for libraries already out there (free or otherwise) that will help out? Thanks!

    Read the article

  • JS regex and angle brackets

    - by chaz
    Seriously, why can't I parse a string with angle brackets using the Javascript regular expression object? var r = new RegExp(), r; r.compile("\\<div\\>", "g"); r = r.exec("<div>Hello</div>"); //Equals null yo Why does that not work?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >