javascript function scope, variable declaration

lets say that I have the following scenario: var namespace = {}; (function($) { $.extend(namespace, { test1: function(someArray, someObj) { for(var i= 0, ii= someArray.length;i<ii;i++) { var text = someObj[someArray[i]]; // do something with text } }, test2: function(someArray, so

javascript函数范围,变量声明

可以说我有以下情况: var namespace = {}; (function($) { $.extend(namespace, { test1: function(someArray, someObj) { for(var i= 0, ii= someArray.length;i<ii;i++) { var text = someObj[someArray[i]]; // do something with text } }, test2: function(someArray, someObj,i,ii,text)

How to check checkboxes in caml query?

In SharePoint 2010 client object model (JavaScript), I am using this caml query to download list items. There is a column called 'Office' and in it, there are several check boxes (ie its a multi-select field). I am looking to get the items where the checkbox in the Office field, that has the name 'Toronto' is checked. I don't want to consider the values of the other checkb

如何检查caml查询中的复选框?

在SharePoint 2010客户端对象模型(JavaScript)中,我使用此Caml查询来下载列表项。 有一个名为'Office'的专栏,其中有几个复选框(即其多选字段)。 我正在寻找获取名称为'Toronto'的Office字段中的复选框被选中的项目。 我不想考虑Office字段中其他复选框的值。 下面的查询不工作,因为我得到0项,当我知道我应该得到更多。 var camlquerystring = " <View> <Query> <Where> <Eq&g

Ember model lifecycle, and reverting to original state

I'm struggling to understand everything about the ember model lifecycle. I have created this jsfiddle to illustrate my problem. When clicking on one of the entries in the list, editing a value, and clicking the versions link to go back to the list, I get the following error: Uncaught Error: Attempted to handle event loadedData on while in state rootState.loaded.updated.uncommitted. Calle

Ember模型生命周期,并恢复到原始状态

我正在努力理解关于烬模型生命周期的一切。 我已经创建了这个jsfiddle来说明我的问题。 当点击列表中的一个条目,编辑一个值,然后单击版本链接返回列表时,出现以下错误: 未捕获的错误:试图处理事件loadedData上,而在状态rootState.loaded.updated.uncommitted。 用{}调用 这是什么造成的? 我知道对象状态现在很脏,但是如何在打开列表时强制刷新所有对象? 此外,如果表单没有保存,如何放弃对属性的所有更改的

Single record persistence with ember

In Ember.js with ember-data (using the 1.0pre versions) all changes to the data are saved into a defaultTransaction on the store. When the store is committed with store.commit() ALL changes to the data are saved back to the API (using the RESTAdapter). I would like more control over objects being persisted. So for now, I have been getting instances of store and adapter, then calling something

带有余烬的单个记录持久性

在带有ember-data的Ember.js中(使用1.0pre版本),对数据的所有更改都将保存到商店的defaultTransaction中。 当商店使用store.commit()提交时,数据的所有更改都将保存回API(使用RESTAdapter)。 我想要更多地控制持久对象。 所以现在,我已经获得了商店和适配器的实例,然后调用类似于adapter.createRecord(store, type, record)或updateRecord type是App.Person模型,记录是该模型的一个实例。 这是使用DS.RESTAdapter

order when drawing in a one

I'm trying to make a simple javascript that draws rectangles on a canvas, then draws the side faces based on a one-point perspective. The problem is, the amount of rectangles and their positioning is arbitrary, so faces tend to overlap in a way that wouldn't happen in true 3D perspective. How can I determine the correct drawing order so that this won't happen? Here are some screen

订单时绘制一个

我试图制作一个简单的JavaScript,在画布上绘制矩形,然后基于一点透视画出侧面。 问题是,矩形的数量和它们的位置是任意的,因此面部倾向于以真正3D透视中不会发生的方式重叠。 我怎样才能确定正确的绘图顺序,使其不会发生? 这里有一些截图来说明我的意思: 截图1 - 错误的方式。 在这一个中,红色,绿色和蓝色块的分组按照它们应该如何绘制的相反顺序绘制。 截图2 - 正确的方法。 这是它应该绘制的方式。 只要你

How to capture an element inside a canvas?

Example: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_canvas_arc I want to learn how to make this entire circle a clickable link, how do I capture that element? How do events work inside a canvas? var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.arc(100, 75, 50, 0, 2 * Math.PI); ctx.stroke();<canvas id="myCanvas" width="300" hei

如何捕捉画布内的元素?

例如:http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_canvas_arc我想学习如何让整个圈子成为一个可点击的链接,我如何捕获该元素? 事件如何在画布内工作? var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.arc(100, 75, 50, 0, 2 * Math.PI); ctx.stroke();<canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;"> Y

Drag and Drop Multiple Objects in HTML5 Canvas

I'm trying to implement an application in which the user can drag and drop multiple objects inside a given area..I'm using html5 canvas tag to implement this..When there is only one object to drag and drop inside the canvas then the code is working fine, but when i try to drag multiple objects independently inside the canvas then i'm not getting the desired output.. Here is the work

在HTML5画布中拖放多个对象

我试图实现一个应用程序,用户可以在一个给定的区域内拖放多个对象。我使用html5 canvas标签来实现这个功能。当只有一个对象在画布内拖放时,代码工作正常,但是当我尝试在画布内独立拖动多个对象时,我没有得到所需的输出。 下面是使用绘图函数只拖放一个对象的工作示例 http://jsfiddle.net/KZ99q/ function draw() { clear(); ctx.fillStyle = "#FAF7F8"; rect(0,0,WIDTH,HEIGHT); ctx.fillStyle = "#444444"; rect(x - 1

Html5 Drag and Drop Mouse Position in Firefox

I have an HTML5 application which utilizes drag and drop. Essentially the user can drag an image from a "drawer" onto a canvas to create a larger image. I want the elements to drop in the place where they were release. I have this working in all browsers except Firefox. On the drop event, I am using the following to get the coordinates of the mouse, and calculate the position of th

Html5在Firefox中拖放鼠标位置

我有一个利用拖放的HTML5应用程序。 基本上,用户可以将图像从“抽屉”拖到画布上以创建更大的图像。 我希望元素在他们发布的地方下降。 我有这个工作在除Firefox以外的所有浏览器。 在drop事件中,我使用以下命令来获取鼠标的坐标,并计算画布内放置图像的位置。 var top = evt.originalEvent.offsetX; var left = evt.originalEvent.offsetY; 问题是,这个属性在FF中不可用。 有没有其他办法可以得到这个? 没有它,我

Dragging and dropping images within multiple boundries in HTML5 canvas

I am new with HTML5. I have to implement such a functionality that I want images to be dropped within a canvas from outside, then there are visible boundaries within canvas and the images can be moved from one boundary to another. It is the same as in the following link, http://custom.case-mate.com/diy?bypassLandingPage=true As, in the site, user selects the pattern and drags images into that

在HTML5画布中拖放多个边界内的图像

我是HTML5新手。 我必须实现这样一种功能,我希望图像从外部放入画布内,然后在画布内存在可见的边界,并且图像可以从一个边界移动到另一个边界。 它与以下链接相同,请访问http://custom.case-mate.com/diy?bypassLandingPage=true 在网站中,用户选择图案并将图像拖入该图像。 然后他可以在边界之间拖动图像。 请给出一些解决方案来实现这样的功能。 这是我尝试过的, <!DOCTYPE HTML> <html> <head&

Graph visualization library in JavaScript

I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so that users can tweak the layout manually by dragging the nodes around. Not

JavaScript中的图形可视化库

我有一个表示有向图的数据结构,并且我想在HTML页面上动态呈现它。 这些图通常只是几个节点,也许在十个高端,所以我的猜测是性能不会是一个大问题。 理想情况下,我希望能够使用jQuery将其绑定,以便用户可以通过拖动节点来手动调整布局。 注意:我不在寻找图表库。 我刚刚把你可能要找的东西放在一起:http://www.graphdracula.net 它是带有定向图形布局的JavaScript,SVG,甚至可以拖动节点。 仍然需要一些调整,但