Created
May 19, 2014 06:43
-
-
Save karanjthakkar/8c139f464e00cdf300d7 to your computer and use it in GitHub Desktop.
A modified version of camden.kittens brackets extension (can close the modal dialog using the 'x' symbol in top right corner)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2013 Jonathan Rowny. All rights reserved. | |
* http://www.jonathanrowny.com | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the | |
* Software is furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in | |
* all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
* DEALINGS IN THE SOFTWARE. | |
*/ | |
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */ | |
/*global define, brackets, $, Mustache, window */ | |
define(function (require, exports, module) { | |
'use strict'; | |
var ExtensionUtils = brackets.getModule("utils/ExtensionUtils"), | |
Dialogs = brackets.getModule("widgets/Dialogs"), | |
AppInit = brackets.getModule("utils/AppInit"), | |
dialogInstance = null; //modification | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function _handleShowKittens() { | |
var kUrl = "http://placekitten.com/" + getRandomInt(400, 500) + "/" + getRandomInt(250, 500); | |
dialogInstance = Dialogs.showModalDialogUsingTemplate('<div class="kittens-dialog template modal hide"><div class="modal-header"><a href="#" class="close">×</a><h1 class="dialog-title">Kittens</h1></div><div class="modal-body"><p class="dialog-message"><img src="' + kUrl + '"></p></div><div class="modal-footer"><a href="#" class="dialog-button btn primary" data-button-id="ok">Done!</a></div></div>'); //modification | |
//modification | |
$(".close").on('click', function() { | |
dialogInstance.close(); | |
}); | |
} | |
AppInit.htmlReady(function () { | |
var $icon; | |
ExtensionUtils.loadStyleSheet(module, "kittens.css"); | |
// Add toolbar icon | |
$icon = $("<a>").attr({ | |
id: "kittens-enable-icon", | |
href: "#" | |
}).click(_handleShowKittens).appendTo($("#main-toolbar .buttons")); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment