Search Results

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

Page 34/309 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Photobooth.js : le framework JavaScript permet d'ajouter un système de webcam à un site Web en utilisant HTML5

    Photobooth.js : le framework JavaScript permet d'ajouter un système de webcam à un site Web en utilisant HTML5 Le HTML5, le futur standard du Web vient de révéler une fois de plus l'une de ses nombreuses facettes. Un développeur indépendant a exploité les nouveautés du langage pour mettre au point Photobooth.js, une bibliothèque open source en JavaScript qui permet d'intégrer dans un site Web assez aisément un système de prise de photo par webcam. Photobooth s'appuie sur la méthode getUserMedia du framework audio et vidéo open source WebRTC, qui est actuellement en cours de standardisation par le W3C comme une partie du HTML5. Photobooth.js permet de prendre dire...

    Read the article

  • Microsoft sort en open source NPM.NET, une bibliothèque qui facilite la gestion des modules Node.js dans une application

    Microsoft sort en open source NPM.NET une bibliothèque qui facilite la gestion des modules Node.js dans une application Bonne nouvelle pour les développeurs Node.js qui éprouvent des difficultés pour gérer les différents modules qui sont utilisés dans leurs applications reposant sur la librairie serveur JavaScript. Microsoft vient de publier en open source NPM.NET, une bibliothèque .NET pour le gestionnaire de modules Node.js (NPM). NPM.NET a été développé à la base pour être utilisé dans une extension pour WebMatrix 2, l'environnement de développement Web gratuit de Microsoft tout-en-un. La bibliothèque permet à l'EDI de disposer d'une interface graphique sous fo...

    Read the article

  • Ext JS Tab Panel - Dynamic Tabs - Tab Exists Not Working

    - by Joey Ezekiel
    Hi Would appreciate if somebody could help me on this. I have a Tree Panel whose nodes when clicked load a tab into a tab panel. The tabs are loading alright, but my problem is duplication. I need to check if a tab exists before adding it to the tab panel. I cant seem to have this resolved and it is eating my brains. This is pretty simple and I have checked stackoverflow and the EXT JS Forums for solutions but they dont seem to work for me or I'm being blind. This is my code for the tree: var opstree = new Ext.tree.TreePanel({ renderTo: 'opstree', border:false, width: 250, height: 'auto', useArrows: false, animate: true, autoScroll: true, dataUrl: 'libs/tree-data.json', root: { nodeType: 'async', text: 'Tool Actions' }, listeners: { render: function() { this.getRootNode().expand(); } } }) opstree.on('click', function(n){ var sn = this.selModel.selNode || {}; // selNode is null on initial selection renderPage(n.id); }); function renderPage(tabId) { var TabPanel = Ext.getCmp('content-tab-panel'); var tab = TabPanel.getItem(tabId); //Ext.MessageBox.alert('TabGet',tab); if(tab){ TabPanel.setActiveTab(tabId); } else{ TabPanel.add({ title: tabId, html: 'Tab Body ' + (tabId) + '', closable:true }).show(); TabPanel.doLayout(); } } }); and this is the code for the Tab Panel new Ext.TabPanel({ id:'content-tab-panel', region: 'center', deferredRender: false, enableTabScroll:true, activeTab: 0, items: [{ contentEl: 'about', title: 'About the Billing Ops Application', closable: true, autoScroll: true, margins: '0 0 0 0' },{ contentEl: 'welcomescreen', title: 'PBRT Application Home', closable: false, autoScroll: true, margins: '0 0 0 0' }] }) Can somebody please help?

    Read the article

  • JS: variable inheritance in anonymous functions - scope

    - by tkSimon
    hey guys, someone from doctype sent me here. long story short: var o="before"; x = function() //this needs to be an anonymous function { alert(o); //the variable "o" is from the parent scope }; o="after"; //this chages "o" in the anonymous function x(); //this results in in alert("after"); //which is not the way i want/need it in reality my code is somewhat more complex. my script iterates through many html objects and adds an event listener each element. i do this by declaring an anonymous function for each element and call another function with an ID as argument. that ID is represented by the "o"-variable in this example. after some thinking i understand why it is the way it is, but is there a way to get js to evaluate o as i declare the anonymous function without dealing with the id attribute and fetching my ID from there? my full source code is here: http://pastebin.com/GMieerdw the anonymous function is on line 303

    Read the article

  • Simple first-child js?

    - by Glister
    Searching for a simple first-child detection via javascript (no framework). It should add some class for the first child of the element. Like a css-hacks for ie, but in javascript and for a html file. Must work similar to :first-child When I say no framework, I mean some code like this: <script type="text/javascript">document.documentElement.id = "js"</script> For example: <div class="terms"> <dl> <dt>Term 1 name</dt> <dd>Term 1 description</dd> </dl> <dl> <dt>Term 2 name</dt> <dd>Term 2 description</dd> </dl> <dl> <dt>Term 3 name</dt> <dd>Term 3 description</dd> </dl> </div> Three <dl>, the first one includes Term 1. This css won't work in IE6, thats why I'm searching for a javascript solution. CSS-hacks are not allowed. .terms dl:first-child { float: right; }

    Read the article

  • moment.js work out time left

    - by user1503606
    I am trying to get my head around the moment.js library as it seems more stable than the jquery one and the jquery date one is output console errors. http://momentjs.com/docs/#/manipulating/ What i am trying to do is do a countdown to work out the time left from now. example i have var countDownTill = '2012-11-19 00:00:00 +0000'; document.write(moment(countDownTill).diff(moment(), 'months') + " months<br>"); document.write(moment(countDownTill).diff(moment(), 'weeks') + " weeks<br>"); document.write(moment(countDownTill).diff(moment(), 'days') + " days<br>"); which will output 0 months 1 weeks 4 days but its not working out overall its doing it individuals for each value (days,weeks,months) so if i up the date by say 12 months like below. var countDownTill = '2013-11-19 00:00:00 +0000'; document.write(moment(countDownTill).diff(moment(), 'months') + " months<br>"); document.write(moment(countDownTill).diff(moment(), 'weeks') + " weeks<br>"); document.write(moment(countDownTill).diff(moment(), 'days') + " days<br>"); it outputs. 12 months 53 weeks 369 days where as i am trying to get it to output 12 months 2 weeks 5 days example here http://jsfiddle.net/fDmWH/3/

    Read the article

  • [JS] getSelection on DIV contentEditable

    - by cactoos
    Hi all ! I am trying to achieve project and i must do a WYSIWYG editor in JavaScript. I can't use an existing editor because I need use my plugins (for example a colorPicker or imagePicker).. For this time I have this HTML : <div class="K_editor" id="idExample"> <div class="K_links"> <div class="K_editor_link K_editor_linkBold">B</div> <div class="K_editor_link K_editor_linkItalic">I</div> <div class="K_editor_link K_editor_linkUnderline">U</div> </div> <iframe width="696" height="212" frameborder="0" src="js/myEditor_iFrame.php"> <html> <head/> <body> <div id="contentIframe" contenteditable="true"> This is a test code, with <strong>bold</strong> text and <em>italic</em> text. </div> </body> </html> </iframe> <input type="submit"/> </div> On event click on ".K_editor_link", a function is open with arguments : - tagStart (exemple '', or '') - tagEnd (exemple '', or '') - id (here 'idExample') I know get a Selection on Textarea but "setSelectionRange()", ".selectionStart" and ".selectionEnd" are only for textbox (XUL), input (XHTML) or textarea (XHTML). Why can I do for do that ?? I'm realy block.. Thank all ! CactO_o's

    Read the article

  • Raphael JS image animation performance.

    - by michael
    Hi, I'm trying to create an image animation using Raphael JS. I want the effect of a bee moving randomly across the page, I've got a working example but it's a bit "jittery", and I'm getting this warning in the console: "Resource interpreted as image but transferred with MIME type text/html" I'm not sure if the warning is causing the "jittery" movement or its just the way I approached it using maths. If anyone has a better way to create the effect, or improvements please let me know. I have a demo online here and heres my javascript code: function random(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function BEE(x, y, scale) { this.x = x; this.y = y; this.s = scale; this.paper = Raphael("head", 915, 250); this.draw = function() { this.paper.clear(); this.paper.image("bee.png", this.x, this.y, 159*this.s, 217*this.s); } this.update = function() { var deg = random(-25, 25); var newX = Math.cos(Raphael.rad(deg)) * 2; var newY = Math.sin(Raphael.rad(deg)) * 2; this.x += newX; this.y += newY; if( this.x > 915) { this.x = 0; } if( this.y > 250 || this.y < 0 ) { this.y = 125; } } } $(document).ready(function() { var bee = new BEE(100, 150, 0.4); var timer = setInterval(function(){ bee.draw(); bee.update(); }, 15); }

    Read the article

  • Automatic multi-page multi-column flowing text with QtWebkit (HTML/CSS/JS -> PDF)

    - by Peter Boughton
    I have some HTML documents that are converted to PDF, using software that renders using QtWebkit (not sure which version). Currently, the documents have specific tags to split into columns and pages - so whenever the wording changes, it is a manual time-consuming process to move these tags so that the columns and pages fit. Can anyone provide a way to have text auto-wrapped into the next column/page (as appropriate) when it reaches the bottom of the current container? Any HTML, CSS or JS supported by QtWebkit is ok (assuming it works in the PDF converter). (I have tested the webkit-column-* in CSS3 and it appears QtWebkit does not support this.) To make things more exciting, it also needs to: - put a header at the top of each page, with page X of Y numbering; - if an odd number of pages, add a blank page at the end (with no header); - have the ability to say "don't break inside this block" or "don't break after this header" I have put some quick example initial markup and target markup to help explain what I'm trying to do. (The actual documents are far more complicated than that, but I need a simple proof-of-concept before I attack the real ones.) Any suggestions? Update: I've got a partially working solution using Aaron's "filling up" suggestion - I'll post more details in a bit.

    Read the article

  • Shadowbox.js and dailymotion videos

    - by Greenie
    Hi there. I have a site set up with some thumbs and links to videos hosted on vimeo. I show them in a overlay using shadowbox.js. This works perfect. Now I want to add a video hosted on dailymotion, but it doesn't work. The working link to vimeo video: <a rel="shadowbox;height=636;width=956" href="http://vimeo.com/moogaloop.swf?clip_id=11377863&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1" class="player_text">thumbnail here</a> The non working link to dailymotion video: <a rel="shadowbox;height=636;width=956" href="http://www.dailymotion.com/swf/xd6g8y?related=0&autoplay=1" class="player_text">thumbnail here</a> When the href is pasted in a browser, both links work fine. Both are played in a swf as far as I can see. So I can't see why shadowbox won't show it. Unless its a permission problem on the dailymotion video. Anyone know what I'm doing wrong?

    Read the article

  • Can't empty JS array....

    - by solefald
    Yes, I am having issues with this very basic (or so it seems) thing. I am pretty new to JS and still trying to get my head around it, but I am pretty familiar with PHP and have never experienced anything like this. I just can not empty this damn array, and stuff keeps getting added to the end every time i run this. I have no idea why, and i am starting to think that it is somehow related to the way chekbox id's are named, but i may be mistaking.... id="alias[1321-213]", id="alias[1128-397]", id="alias[77-5467]" and so on. I have tried sticking checkboxes = []; and checkboxes.length = 0; In every place possible. Right after the beginning of the function, at the end of the function, even outside, right before the function, but it does not help, and the only way to empty this array is to reload the page. Please tell me what I am doing wrong, or at least point me to a place where i can RTFM. I am completely out of ideas here. function() { var checkboxes = new Array(); checkboxes = $(':input[name="checkbox"]'); $.each(checkboxes, function(key, value) { console.log(value.id); alert(value.id); } ); checkboxes.length = 0; } I have also read Mastering Javascript Arrays 3 times to make sure I am not doing something wrong, but still can't figure it out....

    Read the article

  • firefox reading web page from local JS file -- access to restricted URI denied, code: 1012, nsresult

    - by macias
    My problem is -- I have a html file which is really JS program, which reads web pages and show them in customized manner (i.e. it displays the same content in a different way). Basically, I create XMLHttpRequest object and then req.open("GET", web_page_address, false); req.send(""); This gives me (in firefox) an error: Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" I already googled, and looked at SO but all other issues are very similar with those two exceptions: the file I open in firefox is a local file, opened directly in browser -- I don't have www server running at localhost I don't have any control over the web pages I am reading stuff from So, several solutions I've seen so far (like adding PHP proxy, changing the way external server sends data) cannot be applied here. What else can be done in such case? Another story is I am wondering if such strict security for directly local file has any sense. Thank you in advance for tips/links/etc. Have a nice day!

    Read the article

  • JS: capture a static snapshot of an object at a point in time with a method

    - by Barney
    I have a JS object I use to store DOM info for easy reference in an elaborate GUI. It starts like this: var dom = { m:{ old:{}, page:{x:0,y:0}, view:{x:0,y:0}, update:function(){ this.old = this; this.page.x = $(window).width(); this.page.y = $(window).height(); this.view.x = $(document).width(); this.view.y = window.innerHeight || $(window).height(); } I call the function on window resize: $(window).resize(function(){dom.m.update()}); The problem is with dom.m.old. I would have thought that by calling it in the dom.m.update() method before the new values for the other properties are assigned, at any point in time dom.m.old would contain a snapshot of the dom.m object as of the last update – but instead, it's always identical to dom.m. I've just got a pointless recursion method. Why isn't this working? How can I get a static snapshot of the object that won't update without being specifically told to? Comments explaining how I shouldn't even want to be doing anything remotely like this in the first place are very welcome :)

    Read the article

  • Raphael.js map default fill colors

    - by RIDER
    I am trying to familiarize myself with raphael.js. I want to create a USA map that already has default colors for each state and those colors stay there. Here is what I came up with. If you look at AK, I'm getting the default color loaded, but if I highlight another state, the default color for AK disappears. I want AK - and other states - to stay the same color. Specifically, I don't know what is clearing out my AK full color. I think part of this statement is clearing out the fill cover when I mouseover a different state: for (var state in aus) { //aus[state].color = Raphael.getColor(); (function (st, state) { st[0].style.cursor = "pointer"; st[0].onmouseover = function () { current && aus[current].animate({fill: "#333", stroke: "#666"}, 500) && (document.getElementById(current).style.display = ""); st.animate({fill: st.color, stroke: "#ccc"}, 500); st.toFront(); R.safari(); document.getElementById(state).style.display = "block"; current = state; }; })(aus[state], state); } Any ideas where I might be going wrong?

    Read the article

  • jscript1.js error in webforms when applying routing

    - by Sean N
    Hello I have a project using webforms. I applied routing on one of the page. My route is structure like this : http://localhost:3576/Request/Admin/Rejected/ = http://localhost:3576/Request/{role}/{action}/{id} Everything works great but i have a javascript error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Fri, 7 May 2010 13:35:54 UTC Message: Syntax error Line: 3 Char: 1 Code: 0 URI: http://localhost:3576/Request/Admin/Rejected/JScript1.js I think it's trying to route to the file where i stored my javascript functions. Any suggestion?

    Read the article

  • Looping login with Facebook JS SDK and Rails

    - by nafe
    I'm using the Facebook JS SDK for single-sign with my rails app. I translated the php code from the Facebook example (at the bottom of the page under "Single Sign-on with the JavaScript SDK") into ruby. This appeared to be working great but I've noticed one user that gets continual redirects when trying to login. The logs look like: Processing UsersController#login (for X.X.X.X at 2010-05-22 17:25:55) [GET] Redirected to http://myapp.com/ Completed in 0ms (DB: 0) | 302 Found [http://myapp.com/login] (times as many entries as my unfortunate user leaves the browser redirecting in a loop). My client side code includes a callback with the "auth.sessionChange": FB.Event.subscribe('auth.sessionChange', function(response) { if (response.session) { // A user has logged in, and a new cookie has been saved window.location = "/login"; } else { // The user has logged out, and the cookie has been cleared window.location = "/logout"; } }); So it seems to me like this event is continually firing. Although, I can't test this theory because I can't recreate this scenario locally. I don't think it's the rails controller. The code here is just: def login # if first time user create db entry # now redirect back to where the user came from begin redirect_to :back rescue ActionController::RedirectBackError redirect_to root_url end end Does anyone have any idea on what's going on?

    Read the article

  • VS2010 renders controls JS awkwardly

    - by Juergen Hoffmann
    I have created a Website Project in VS2010. My Controls are not rendered correctly. The JS that is produced is not correctly formatted. Here is an example: protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { objListBox.Attributes.Add("onchange", "Control_doPostBack('" + objListBox.ClientID + "','ListBox_OnClick'); return false;"); objListBox.Attributes.Add("onblur", "Control_doPostBack('" + trListbox.ClientID + "','ListBox_OnBlur'); return false;"); img.Attributes.Add("onclick", "Control_doPostBack('" + trListbox.ClientID + "','IMG_OnClick'); return false;"); } } and the responding control is rendered as: <select size="4" name="ctl00$PlaceHolder_Content$drop$objListBox" onchange="Control_doPostBack(&#39;PlaceHolder_Content_drop_objListBox&#39;,&#39;ListBox_OnClick&#39;); return false;setTimeout(&#39;__doPostBack(\&#39;ctl00$PlaceHolder_Content$drop$objListBox\&#39;,\&#39;\&#39;)&#39;, 0)" id="PlaceHolder_Content_drop_objListBox" onblur="Control_doPostBack(&#39;PlaceHolder_Content_drop_trListbox&#39;,&#39;ListBox_OnBlur&#39;); return false;" style="position:absolute;"> </select> As you can see, the ' are rendered to &#39 which screwes up the Browser. Is there a tweak to msbuild or inside the project properties? Any help is highly appreciated.

    Read the article

  • Browser dependent problem rendering WMD with Showdown.js?

    - by CMPalmer
    This should be easy (at least no one else seems to be having a similar problem), but I can't see where it is breaking. I'm storing Markdown'ed text in a database that is entered on a page in my app. The text is entered using WMD and the live preview looks correct. On another page, I'm retrieving the markdown text and using Showdown.js to convert it back to HTML client-side for display. Let's say I have this text: The quick **brown** fox jumped over the *lazy* dogs. 1. one 1. two 4. three 17. four I'm using this snippet of Javascript in my jQuery document ready event to convert it: var sd = new Attacklab.showdown.converter(); $(".ClassOfThingsIWantConverted").each(function() { this.innerHTML = sd.makeHtml($(this).html()); } I suspect this is where my problem is, but it almost works. In FireFox, I get what I expected: The quick brown fox jumped over the lazy dogs. one two three four But in IE (7 and 6), I get this: The quick brown fox jumped over the lazy dogs. 1. one 1. two 4. three 17. four So apparently, IE is stripping the breaks in my markdown code and just converting them to spaces. When I do a view source of the original code (prior to the script running), the breaks are there inside the container DIV. What am I doing wrong? UPDATE It is caused by the IE innerHTML/innerText "quirk" and I should have mentioned before that this one on an ASP.Net page using data bound controls - there are obviously a lot of different workarounds otherwise.

    Read the article

  • ASP.Net MVC, JS injection and System.ArgumentException - Illegal Characters in path

    - by Mose
    Hi, In my ASP.Net MVC application, I use custom error handling. I want to perform custom actions for each error case I meet in my application. So I override Application_Error, get the Server.GetLastError(); and do my business depending on the exception, the current user, the current URL (the application runs on many domains), the user IP, and many others. Obviousely, the application is often the target of hackers. In almost all the case it's not a problem to detect and manage it, but for some JS URL attacks, my error handling does not perform what I want it to do. Ex (from logs) : http://localhost:1809/Scripts/]||!o.support.htmlSerialize&&[1 When I got such an URL, an exception is raised when accessing the ConnectionStrings section in the web.config, and I can't even redirect to another URL. It leads to a "System.ArgumentException - Illegal Characters in path, etc." The screenshot below shows the problem : http://screencast.com/t/Y2I1YWU4 An obvious solution is to write a HTTP module to filter the urls before they reach my application, but I'd like to avoid it because : I like having the whole security being managed in one place (in the Application_Error() method) In the module I cannot access the whole data I have in the application itself (application specific data I don't want to debate here) Questions : Did you meet this problem ? How did you manage it ? Thanks for you suggestions, Mose

    Read the article

  • Function in JS returns undefined

    - by megapool020
    Hello there, I have the following problem. The alert allways returns undefined, but I know it has a value. What am I doing wrong. I'm out of solutions... I'm using JQUERY jquery-1.4.2.min.js Tnx in advance $(document).ready(function(){ $('#generateButton').click(createIBAN); }); function createIBAN(){ //---- First check if a bank has been selected, //---- if not, then show error if($('#selectBank').val()==''){ alert('Selecte a bank!'); }else{ var bankAccount = generateBankAccount(); alert(bankAccount); } return false; } function generateBankAccount(){ //---- Create "elfproef" bankaccount var bankAccount = ''; //---- Set the amount of digits in a bankaccount digitAmount = 9; //---- Make random digitstring for (var i = 0; i < digitAmount; i++) { bankAccount += Math.floor(Math.random() * digitAmount); } //---- validate the string, if not "elf-proef" if (elfProef(bankAccount)==false) { //---- regenerate the string generateBankAccount(); }else{ return bankAccount; } } function elfProef(bankAccount) { //---- set sum to 0 and start the for-loop for counting var sum = 0; for (var i = 0; i < digitAmount; i++) { //---- for every digit multiply it times 9 - number //---- of the digit and count it to the sum var sum += bankAccount.charAt(i) * (digitAmount - i); } //---- Check if sum can be devided by 11 without having ##,## if(sum % 11==0){ //---- return true means string is "elf-proef" return true; }else { //---- String is not "elf-proef", try again return false; } }

    Read the article

  • Is there a Firebug console -vsdoc.js?

    - by David Murdoch
    If not, does anyone care to write one? I would do it myself...but I don't have time right now...maybe next week (unless someone beats me to it). If you are bored and want to compile the vsdoc: Here is the Firebug API. Here is a blog post about the format for VS doc comments for intellisense. Here is an example vsdoc (jquery-1.4.1-vsdoc.js). I created the following because I kept typing cosnole instead of console. You can use it as a starting point (ish). console = { /// <summary> /// 1: The javascript console /// </summary> /// <returns type="Object" /> }; console.log = function (object) { /// <summary> /// Write to the console's log /// </summary> /// <returns type="null" /> /// <param name="object" type="Object"> /// Write the object to the console's log /// </param> };

    Read the article

  • SetInterval missing property in js class

    - by sebastian
    I wrote simple class in JS witch works, but i had problem when i try use setInterval with it. Ex. if i do something like that ball = new ball(5,10,0, '#canvas'); ball.draw(); ball.draw(); ball.draw(); ball.draw(); It works. But this: ball = new ball(5,10,0, '#canvas'); setInterval(ball.draw, 100); Not work. I get error that values are undefined. function ball (x,y,z,holdingEl) { this.r = 5; //zmienna przechowujaca promien pilki this.size = this.r *2; // zmienna przechowujaca rozmiar this.ballSpeed = 100; // predkosc pilki this.ballWeight = 0.45; // masa pilki this.maxFootContactTime = 0.2; // maksymalny czas kontaktu pilki z noga - stala this.ctx = jQuery(holdingEl)[0].getContext("2d"); // obiekt pilki this.intVal = 100 // predkosc odswiezania this.currentPos = { // wspolrzedne pozycji x: x, y: y, z: z } this.interactionPos = { // wspolrzedne pozycji ostatniej interakcji x: -1, y: -1, z: -1 } this.direct = { // kierunek w kazdej plaszczyznie x : 1, y : 0, z : 0 } this.draw = function (){ this.ctx.clearRect(0,0,1100,800); this.ctx.beginPath(); this.ctx.arc(this.currentPos.x, this.currentPos.y, this.r, 0, Math.PI*2, true); this.ctx.closePath(); this.ctx.fill(); } }

    Read the article

  • How to implement conditional render in JS?

    - by mare
    Below is the JS (jQuery) code of autocomplete's result function. You can see there's some lines where I print out <li>s containing some data properties (that come in as a result of automcomplete's AJAX call). How could I rewrite this so that <li> would be conditionally rendered based on whether the property contains any value being either int or string (not empty string or whitespace) or something else that can be represented as string? $(".clients-dropdown").result(function (event, data, formatted) { if (data) { // set the hidden input that we need for Client entity rematerialize $(".client-id").val(data.client_id); if (data.ClientName && data.Address1 && data.postalcode && data.postname) { $(".client-address").html( "<li>" + data.ClientName + "</li>" + "<li>" + data.Address1 + "</li>" + "<li>" + data.postalcode + " " + data.postname + "</li>" ); $(".client-details").html( "<li>" + data.PrettyId + "</li>" + "<li>" + data.VatNo + "</li>" + "<li>" + data.Phone + "</li>" + "<li>" + data.Mobile + "</li>" + "<li>" + data.Email1 + "</li>" + "<li>" + data.Contact + "</li>" ); } } Also, for the AJAX call, should my server side action return null when there's a null for a property in the database or empty string?

    Read the article

  • Firefox extension js object initialization

    - by Michael
    Note: this is about Firefox extension, not a js general question. In Firefox extension project I need my javascript object to be initialized just once per Firefox window. Otherwise each time I open my window a new timers will be engaged, new properties will be used, so everything will start from scratch. hope example below will demystify my question :) var StupidExtension { statusBarValue: "Not Initialized Yet", startup: function () { ... // Show statusBarValue in Status Bar Panel }, initTimerToRetrieveStatusBarValueFromNetwork: function () { ... } } so each time you hit Ctrl+N a new window you will see "Not Initialized Yet" and then new timer will be fired, so after some time it retrieve data from network you will see value also on second window and so on. Ideally would be to have just a single timer function running and updating all status bar panels in all Firefox windows. Of course I can do some caching, like saving the value in prefs or some other storage, then show it from there. But I feel like this is artificial. So the question will be is there "native" technique of making static some parts of the object among all Firefox window instances?

    Read the article

  • JS: Object itteration fails

    - by Newbie
    Hello! In my JS, I have an object called box_object. It looks like this: ({ id:"3", text:"this is a box object", connection_parent:["1", "2"], connection_child:["5", "6"], connectiondata_child:{ 0:{id:"5", linepoint:"bottom"}, 1:{id:"6", linepoint:"bottom"}}, connectiondata_parent:{ 0:{id:"1", linepoint:"top"}, 1:{id:"2", linepoint:"top"}} }) Now, I want to add some position values to box_object.connectiondata_parent. Using jQuery I can use the .each() method. So I tried it, but it failed. In my function I do the following: $(box_object.connectiondata_parent).each(function(it, obj){ if(typeof(obj[it]) != "undefined" && obj[it].linepoint == "top"){ var point_position_top = new Object(); point_position_top.left = startingpoint_left; point_position_top.top = startingpoint_top; obj[it].position = point_position_top; }else if(typeof(obj[it]) != "undefined" && obj[it].linepoint == "bottom"){ var point_position_bottom = new Object(); point_position_bottom.left = startingpoint_left; point_position_bottom.top = startingpoint_bottom; obj[it].position = point_position_bottom; }else{} }); After the function my box_object looks like this: ({ id:"3", text:"this is third box", connection_parent:["1", "2"], connection_child:["5", "6"], connectiondata_child:{ 0:{id:"5", linepoint:"bottom"}, 1:{id:"6", linepoint:"bottom"}}, connectiondata_parent:{ 0:{id:"1", linepoint:"top", position:{left:500, top:104}}, 1:{id:"2", linepoint:"top"}} }) It seems it only writes the values to the first "value". Any Ideas why?

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >