From 7bee50379c1df86bb571e0e8d6c08e24d25231f5 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 9 Jul 2012 16:38:08 -0700 Subject: BSD License --- js/controllers/clipboard-controller.js | 23 +- js/controllers/color-controller.js | 31 +-- js/controllers/document-controller.js | 27 +-- js/controllers/elements/block-controller.js | 23 +- js/controllers/elements/body-controller.js | 23 +- js/controllers/elements/canvas-controller.js | 23 +- js/controllers/elements/component-controller.js | 23 +- js/controllers/elements/controller-factory.js | 23 +- js/controllers/elements/element-controller.js | 31 +-- js/controllers/elements/image-controller.js | 23 +- js/controllers/elements/shapes-controller.js | 25 +- js/controllers/elements/stage-controller.js | 23 +- js/controllers/elements/video-controller.js | 23 +- js/controllers/local-storage-controller.js | 23 +- js/controllers/main-menu-controller.js | 23 +- js/controllers/objects-controller.js | 29 +-- js/controllers/presets-controller.js | 23 +- js/controllers/selection-controller.js | 23 +- js/controllers/styles-controller.js | 299 ++++++++++++------------ js/controllers/undo-controller.js | 25 +- 20 files changed, 393 insertions(+), 373 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/clipboard-controller.js b/js/controllers/clipboard-controller.js index 74aef060..c19896d0 100644 --- a/js/controllers/clipboard-controller.js +++ b/js/controllers/clipboard-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index c5c614ea..c02561bf 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -27,7 +28,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + //////////////////////////////////////////////////////////////////////// // var Montage = require("montage/core/core").Montage, @@ -163,7 +164,7 @@ exports.ColorController = Montage.create(Component, { // getBorder: { value: function (element) { - + } }, //////////////////////////////////////////////////////////////////// @@ -262,14 +263,14 @@ exports.ColorController = Montage.create(Component, { c = this.parseCssToColor('rgb('+temp[0]+')'); gradient.stops.push({css: c.css, value: c.value, mode: c.mode, position: parseInt(temp[1].replace(/\%/i, ""))}); } else if (css.indexOf('rgba') >= 0) { - + temp = arr[j].split('rgba'); temp = temp[1].replace(/\(/i, ""); temp = temp.split(')'); c = this.parseCssToColor('rgba('+temp[0]+')'); gradient.stops.push({css: c.css, value: c.value, mode: c.mode, position: parseInt(temp[1].replace(/\%/i, ""))}); } - } + } } else if (css.indexOf('-webkit-gradient') >= 0) { //Linear gradient gradient.stops = []; diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1a8fec98..540fc307 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -246,7 +247,7 @@ exports.DocumentController = Montage.create(Component, { } }, //////////////////////////////////////////////////////////////////// - + /** * Public method * doc contains: @@ -361,7 +362,7 @@ exports.DocumentController = Montage.create(Component, { } }, //////////////////////////////////////////////////////////////////// - + openProjectWithURI: { value: function(uri) { console.log("URI is: ", uri); diff --git a/js/controllers/elements/block-controller.js b/js/controllers/elements/block-controller.js index d83fa80e..c33df97f 100755 --- a/js/controllers/elements/block-controller.js +++ b/js/controllers/elements/block-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index c3912038..8e8fd834 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js index 17ac4a1e..2fef1300 100755 --- a/js/controllers/elements/canvas-controller.js +++ b/js/controllers/elements/canvas-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index fab07951..df9fbab1 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/controller-factory.js b/js/controllers/elements/controller-factory.js index 2bf3eae0..50bca139 100755 --- a/js/controllers/elements/controller-factory.js +++ b/js/controllers/elements/controller-factory.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 39efcf0c..8b276473 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -36,9 +37,9 @@ exports.ElementController = Montage.create(Component, { addElement: { value: function(el, styles) { - + if (el.getAttribute) el.setAttribute('data-ninja-node', 'true'); - + // Updated to use new methods in TimelinePanel. JR. var insertionIndex = this.application.ninja.timeline.getInsertionIndex(); if (insertionIndex === false) { @@ -51,7 +52,7 @@ exports.ElementController = Montage.create(Component, { element.parentNode.insertBefore(el, element.nextSibling); } } - + if(styles) { this.application.ninja.stylesController.setElementStyles(el, styles); } @@ -67,7 +68,7 @@ exports.ElementController = Montage.create(Component, { el.parentNode.removeChild(el); } }, - + getProperty: { value: function(el, prop, fallbackOnComputed, isStageElement) { if(el.nodeType !== 3){ diff --git a/js/controllers/elements/image-controller.js b/js/controllers/elements/image-controller.js index acf1525d..c4ff8ca9 100755 --- a/js/controllers/elements/image-controller.js +++ b/js/controllers/elements/image-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index a0d3c0d6..32699416 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -300,7 +301,7 @@ exports.ShapesController = Montage.create(CanvasController, { return null; } break; - + case "strokeMaterial": var sm = el.elementModel.shapeModel.GLGeomObj.getStrokeMaterial(); diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index f84c5f98..3be220a6 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/elements/video-controller.js b/js/controllers/elements/video-controller.js index ceaea163..163644a3 100755 --- a/js/controllers/elements/video-controller.js +++ b/js/controllers/elements/video-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/local-storage-controller.js b/js/controllers/local-storage-controller.js index 69d993ba..158a7f41 100755 --- a/js/controllers/local-storage-controller.js +++ b/js/controllers/local-storage-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/main-menu-controller.js b/js/controllers/main-menu-controller.js index 31019829..a2ae9802 100644 --- a/js/controllers/main-menu-controller.js +++ b/js/controllers/main-menu-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 0462df98..27311155 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -73,11 +74,11 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { } } }, - + /* -------------------------- Binding Methods ----------------------------- */ - + addBinding : { value: function(bindingArgs) { if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } @@ -122,7 +123,7 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { } }, - + getObjectBindings : { value: function(object) { var descriptors = object._bindingDescriptors, diff --git a/js/controllers/presets-controller.js b/js/controllers/presets-controller.js index 78458e0b..8019e114 100644 --- a/js/controllers/presets-controller.js +++ b/js/controllers/presets-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index d0e239b6..40551ef0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 1030acb4..89a389a4 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -59,26 +60,26 @@ Methods: - Delete stylesheets - Enable stylesheets - Disable stylesheets - + use case : set background color - needs to know most specific rule WITH that property - - + - */ var stylesController = exports.StylesController = Montage.create(Component, { - + ///// Initialize after the active document has been set, and ///// bind the document to prop w/ setter. The setter calls to find ///// the stage and default css files. - ///// Active document gets automatically set when the + ///// Active document gets automatically set when the ///// document controller changes it _currentDocument : { value : null, enumerable : false }, - + currentDocument : { get : function() { return this._currentDocument; @@ -97,7 +98,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// setting document via binding this._currentDocument = document; - + ///// Stage stylesheet should always be found this._stageStylesheet = this.getSheetFromElement(this.CONST.STAGE_SHEET_ID); // Returns null if sheet not found (as in non-ninja projects) @@ -191,29 +192,29 @@ var stylesController = exports.StylesController = Montage.create(Component, { } }, /* ----------------- Rule methods ----------------- */ - + ///// Add Rule ///// Passed in rule will be appended to the default stylesheet ///// The rule can be in the form of a string (one argument), or ///// the selector string and declaration string (two arguments), or ///// the selector string and a declaration object. ///// Optionally pass in the rule index (defaults to end of sheet) - + /* - Signature 1 : + Signature 1 : addRule( "#div1", "color:blue; width:100px;", 3) [str] [str] [num] - - Signature 2 (w/ styles object literal): + + Signature 2 (w/ styles object literal): addRule( "#div1", { color:"blue", width:"100px" }, 3) [str] [obj] [num] - - Signature 3 (w/ full rule as one string) : + + Signature 3 (w/ full rule as one string) : addRule( "#div1 { color:blue; width:100px; }", 3) [str] [num] - + */ - + addRule : { value : function(selector, declaration, stylesheet, index) { stylesheet = stylesheet || this._defaultStylesheet; @@ -228,20 +229,20 @@ var stylesController = exports.StylesController = Montage.create(Component, { rule; index = index || (argType === 'number') ? declaration : rulesLength; - + if(argType === 'string') { ruleText += '{' + declaration + '}'; } else if(argType === 'object') { ruleText += '{' + this.cssFromObject(declaration) + '}'; } - + stylesheet.insertRule(ruleText, index); ///// Invalidate cache because rule dominance is affected this._clearCache(); this.styleSheetModified(stylesheet); - + rule = stylesheet.rules[index]; ///// attach specificity to rule object @@ -256,7 +257,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { return rule; } }, - + ///// Create Override Rule ///// Takes a given rule and creates a rule with a selector of equal ///// or greater specificity, and inserts it after the original rule @@ -264,10 +265,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// and the class will have to be applied to the element in order for ///// the rule to stick ///// Returns an object containing this classname and the rule itself - + createOverrideRule : { value : function(ruleToOverride, element) { - + ///// Locally-scoped function to de-clutter variable declarations function getSelector(el, rule) { return this._getMostSpecificSelectorForElement(el, rule[this.CONST.SPECIFICITY_KEY]).selector; @@ -283,12 +284,12 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Create new rule with selector and insert it after the rule we're overriding rule = this.addRule(overrideData.selector + ' { }', this.getRuleIndex(ruleToOverride)+1); - + return { className : overrideData.className, rule : rule }; - + } }, @@ -341,18 +342,18 @@ var stylesController = exports.StylesController = Montage.create(Component, { }; } }, - + ///// Delete Rule ///// Deletes the passed-in rule from its stylesheet ///// Argument can be the index of the rule, or the rule itself ///// If the index is passed, the sheet must be passed in - + deleteRule : { value : function(rule, sheet) { var index; - + if(typeof rule === 'number') { - ///// 1st arg is the index + ///// 1st arg is the index index = rule; } else { ///// derive the index of the rule @@ -360,7 +361,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// the sheet is a property of the rule sheet = rule.parentStyleSheet; } - + if(index > -1) { sheet.deleteRule(index); } @@ -370,22 +371,22 @@ var stylesController = exports.StylesController = Montage.create(Component, { return index; } }, - + ///// Get Dominant Rule For Style - ///// Given an element, this method returns the dominant rule + ///// Given an element, this method returns the dominant rule ///// for the particular style property. ///// Optionally, it returns an override object if no single-target ///// rule is found. ///// An override object consists of a rule to override, and a ///// flag for using !important or not - + getDominantRuleForElement : { value : function(element, property, returnOverrideObject, useStageStyleSheet) { var matchedRules = this.getMatchingRules(element, true, useStageStyleSheet), doc = element.ownerDocument, useImportant = false, inLineStyleRule, rulesWithProperty, importantRules, dominantRule; - + ///// First, since an element's style attribute is a CSSStyleDeclaration ///// and not a CSSStyleRule, we want to create an imitation rule object ///// to act like any returned by getMatchedCSSRules @@ -417,7 +418,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { - Get 2) No rules with the property (i.e., no chance of property collision) - use the original rule list to find the most specific, single-target rule - - start with the highest specificity to minimize calls to querySelectorAll() + - start with the highest specificity to minimize calls to querySelectorAll() - if there is no single-target rule, create a new rule to apply this style */ @@ -439,7 +440,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { //dominantRule = this._getFirstSingleTargetRule(rulesWithProperty, doc); dominantRule = rulesWithProperty[0]; } - + } else { // no rules with property ///// In this case, we don't want to use the inline style ///// Important flag is irrelevant because the style property isn't defined @@ -457,7 +458,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { singleTargetBackup : this._getFirstSingleTargetRule(matchedRules.slice(1), doc) }; } - + return dominantRule; } }, @@ -525,58 +526,58 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Disable Rule ///// Disables a rule by giving it a known garbage selector - + disableRule : { value : function(rule, sheet) { rule = (typeof rule === 'number') ? sheet.rules[rule] : rule; - + rule.selectorText += this.CONST.GARBAGE_SELECTOR; - + return rule; } }, - + ///// Enable Rule ///// Enables a rule by removing the known garbage selector - + enableRule : { value : function(rule, sheet) { rule = (typeof rule === 'number') ? sheet.rules[rule] : rule; - + ///// remove any occurances of the garbage selector rule.selectorText.replace(this.CONST.GARBAGE_SELECTOR, ''); - + return rule; } }, - + ///// Has Property ///// Checks to see if a rule has the property defined in ///// its declaration. ///// Optionally checks for shortand property - + hasProperty : { value: function(rule, property, checkForShorthand) { var properties = [property], shorthands = cssShorthandMap[property]; - + ///// If shorthand properties are defined, add to the array ///// of which properties to check for if(shorthands) { properties.concat(shorthands); } - + ///// return true if any property exists in rule return properties.some(function(prop) { return !!rule.style.getPropertyValue(prop); }, this); - + } }, - + ///// Matches Multiple Elements ///// Checks to see if the rule affects multiple elements - + matchesMultipleElements : { value: function(rule, document) { if(rule.isInlineStyle) { @@ -606,12 +607,12 @@ var stylesController = exports.StylesController = Montage.create(Component, { } }, - - + + ///// Set Rule Selector ///// Allows user to change the selector of given rule ///// while attaching new specificity value to rule object - + setRuleSelector : { value : function(rule, selector) { rule.selectorText = selector; @@ -622,13 +623,13 @@ var stylesController = exports.StylesController = Montage.create(Component, { return rule; } }, - + ///// Get Rule Index ///// Returns the index of the passed-in rule. ///// Returns -1 if not found. ///// A rule's index is useful to know for deleting, inserting ///// and determining rule precedence - + getRuleIndex : { value : function(rule) { var rules = nj.toArray(rule.parentStyleSheet.rules); @@ -666,7 +667,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { ///// Get All Matching Rules ///// Returns an array of css rules for an element ///// Optionally sorted by specificity, and can omit pseudo elements - + getMatchingRules : { //TODO: Remove omitPseudos from here and usages value: function(element, omitPseudos, useStageStyleSheet) { var rules, @@ -748,17 +749,17 @@ var stylesController = exports.StylesController = Montage.create(Component, { return order; } - + rules.sort(sorter.bind(this)); - + return rules; } }, - + ///// Get Common Rules ///// Returns an array of rules that are common to all the elements ///// in passed-in element array. - + getCommonRules : { value : function(elements) { var itemIndex = -1, @@ -783,17 +784,17 @@ var stylesController = exports.StylesController = Montage.create(Component, { return commonRules; } }, - + ///// Get Most Specific Selector For Element ///// Given a selector+specificity array, find the most specific ///// selector for the passed-in element - + _getMostSpecificSelectorForElement : { value : function(element, specArr) { - if(specArr.length === 1) { + if(specArr.length === 1) { return specArr[0]; } - + var matchingElements, i; for(i = 0; i < specArr.length; i++) { @@ -840,12 +841,12 @@ var stylesController = exports.StylesController = Montage.create(Component, { } }, - + ///// Get First Single Target Rule ///// Loops through the array of rules sequentially, returning the first ///// single-target rule (i.e. first rule which affects only one element) ///// Returns null if no single target rule is found - + _getFirstSingleTargetRule : { value : function(rules, document) { var i; @@ -857,32 +858,32 @@ var stylesController = exports.StylesController = Montage.create(Component, { return null; } }, - + ///// Compare Specificity ///// Takes two specificity objects and returns: ///// -1 if first is more specific than second ///// +1 if second is more speficic than first ///// 0 if equal in specificity - + compareSpecificity : { value : function(a, b) { var specA = a, specB = b, order; - + [this.CONST.SPEC_ID_KEY,this.CONST.SPEC_CLASS_KEY,this.CONST.SPEC_TYPE_KEY].some(function(t) { order = specA[t] < specB[t] ? 1 : (specA[t] > specB[t]) ? -1 : 0; return order !== 0; }, this); - + return order; } }, - + ///// Get specificity - ///// Creates array of objects, ordered by specificity for each + ///// Creates array of objects, ordered by specificity for each ///// selector in the passed-in selectorText. - + getSpecificity : { value : function(selector) { var arr = selector.split(',').map(function(sel) { @@ -891,14 +892,14 @@ var stylesController = exports.StylesController = Montage.create(Component, { specificity : this.calculateSpecificity(sel) }; }, this); - + ///// now sort by specificity return arr.sort(function(a, b) { return this.compareSpecificity(a.specificity, b.specificity); }.bind(this)); } }, - + ///// Calculate specificity ///// Returns the specificity value of passed-in selector ///// WARNING: Do not pass in grouped selectors! @@ -911,36 +912,36 @@ var stylesController = exports.StylesController = Montage.create(Component, { value : function(selector) { var s = selector.replace(/\([^\)]+\)/,''), obj = {}; - + ///// function for counting matches for different ///// selector patterns function m(reg) { var matches = s.match(reg); return matches ? matches.length : 0; } - + obj[this.CONST.SPEC_ID_KEY] = m(/#[\d\w-_]+/g); /// match id selector obj[this.CONST.SPEC_CLASS_KEY] = m(/[\.:\[][^\.:\[+>]+/g); /// match class selector obj[this.CONST.SPEC_TYPE_KEY] = m(/(^|[\s\+>])\w+/g); /// match tag selector - + return obj; } }, - + /* ----------------- Style methods ----------------- */ - + ///// Add style ///// Set style property and value on provided rule ///// with optional priority (!important) ///// Returns the browser's value of passed-in property - + setStyle : { value: function(rule, property, value, useImportant) { var dec = rule.style, priority; - + ///// Remove property for passive validation (sets it to null) dec.removeProperty(property); - + priority = (useImportant) ? this.IMPORTANT_FLAG : null; ///// Use CSS declaration's setProperty() @@ -955,23 +956,23 @@ var stylesController = exports.StylesController = Montage.create(Component, { return dec.getPropertyValue(property); } }, - + ///// Add styles ///// Set multiple styles on provided rule ///// Returns a collection of browser values for the ///// passed-in properties - + setStyles : { value: function(rule, styles, useImportant) { var browserValues = {}, property, value; - + for(property in styles) { if(styles.hasOwnProperty(property)) { value = styles[property]; browserValues[property]