Permalink
Browse files

Merge branch 'master' of https://github.com/GoogleChrome/chrome-app-s…

  • Loading branch information...
mangini committed Aug 9, 2012
2 parents 90f064b + 04cee7b commit 2e53281bfc63ae4db43d5c0dbde4758520f22caf
Showing with 1,240 additions and 34 deletions.
  1. +1 −1 browser-tag/README.md
  2. +1 −1 calculator/README.md
  3. BIN calculator/assets/calculator_1280-800.png
  4. BIN calculator/assets/icon-128x128.png
  5. BIN calculator/assets/screenshot-640x400.png
  6. BIN calculator/assets/tile-image-440x280.png
  7. +1 −1 calculator/manifest.json
  8. +1 −7 calculator/model.js
  9. +11 −3 calculator/style.css
  10. +1 −1 calculator/view.js
  11. +1 −1 hello-world/README.md
  12. +2 −11 mini-code-edit/background.js
  13. +8 −6 sandbox/README.md
  14. +1 −1 singleton/README.md
  15. BIN weather/.DS_Store
  16. BIN weather/img/cloudy.png
  17. BIN weather/img/hail.png
  18. BIN weather/img/icon-128x128.png
  19. BIN weather/img/icon-16x16.png
  20. BIN weather/img/icon-64x64.png
  21. BIN weather/img/light-rain.png
  22. BIN weather/img/light-snow.png
  23. BIN weather/img/mostly-sunny.png
  24. BIN weather/img/partly-cloudy.png
  25. BIN weather/img/plus.png
  26. BIN weather/img/rain-snow.png
  27. BIN weather/img/rain.png
  28. BIN weather/img/scattered-light-rain.png
  29. BIN weather/img/scattered-rain.png
  30. BIN weather/img/scattered-snow.png
  31. BIN weather/img/scattered-tstorm.png
  32. BIN weather/img/snow.png
  33. BIN weather/img/sunny.png
  34. BIN weather/img/tooltip.png
  35. BIN weather/img/triangle-down.png
  36. BIN weather/img/tstorm.png
  37. BIN weather/img/world.png
  38. BIN weather/img/x.png
  39. BIN weather/lib/.DS_Store
  40. +122 −0 weather/lib/jquery-1.2.7.tools.min.js
  41. +4 −0 weather/lib/jquery-1.7.2.min.js
  42. +17 −0 weather/lib/jquery-ui-1.8.22.custom.min.js
  43. +191 −0 weather/lib/tipTipv13/jquery.tipTip.js
  44. +21 −0 weather/lib/tipTipv13/jquery.tipTip.minified.js
  45. +113 −0 weather/lib/tipTipv13/tipTip.css
  46. +6 −0 weather/main.js
  47. +23 −0 weather/manifest.json
  48. +361 −0 weather/style.css
  49. +25 −0 weather/weather.html
  50. +328 −0 weather/weather.js
  51. +1 −1 windows/README.md
View
@@ -9,7 +9,7 @@ The app's main window contains a `<browser>` that is sized to fit most of it (vi
* Experimental
* browserTag
-[See more on permissions](http://code.google.com/chrome/extensions/manifest.html#permissions)
+[See more on permissions](http://developer.chrome.com/trunk/apps/manifest.html#permissions)
## APIs
View
@@ -10,7 +10,7 @@ DOM manipulation.
* Experimental
-[See more on permissions](http://code.google.com/chrome/extensions/manifest.html#permissions)
+[See more on permissions](http://developer.chrome.com/trunk/apps/manifest.html#permissions)
## APIs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -2,7 +2,7 @@
"name": "Calculator",
"description": "A simple calculator.",
"manifest_version": 2,
- "version": "1.0.11",
+ "version": "1.0.12",
"app": {
"background": {
"scripts": ["main.js"]
View
@@ -86,13 +86,7 @@ Calculator.prototype.HandleButtonClick = function(buttonValue) {
result = this.operand;
break;
case '+ / -':
- if (this.operatorNeedsReset) {
- this.operatorNeedsReset = false;
- this.operator = null;
- this.operand = null;
- }
- if (this.accumulator == 0) this.accumulator = this.operand;
- this.accumulator *= -1;
+ this.operand *= -1;
break;
case 'back':
this.accumulatorNeedsReset = false;
View
@@ -75,10 +75,12 @@ body {
.equation .operator {
color: #2c2c2c;
width: 15px;
- height: 16px;
float: right;
padding-right: 5px;
height: 22px;
+ line-height: 16px;
+ padding-top: 3px;
+ padding-bottom: 3px;
}
.equation .operand {
@@ -87,7 +89,10 @@ body {
max-width: 80px;
text-align: right;
overflow: hidden;
- height: 22px;
+ height: 16px;
+ line-height: 16px;
+ padding-top: 3px;
+ padding-bottom: 3px;
}
.equation .accumulator {
@@ -98,7 +103,10 @@ body {
max-width: 80px;
text-align: left;
overflow: hidden;
- height: 22px;
+ height: 13px;
+ line-height: 13px;
+ padding-top: 6px;
+ padding-bottom: 3px;
}
#display .hr {
View
@@ -119,7 +119,7 @@ View.prototype.buttonClicked = function(clicked, result) {
this.lastDisplayElement = null;
}
else if (clicked == '+ / -') {
- this.UpdateDisplayEquation(operator, operand, accumulator);
+ this.UpdateDisplayEquation(operator, operand, '');
}
else if (this.lastDisplayElement) {
accumulator = '';
View
@@ -14,7 +14,7 @@ chrome.experimental.app.onLaunched.addListener(function() {
* Experimental
-[See more on permissions](http://code.google.com/chrome/extensions/manifest.html#permissions)
+[See more on permissions](http://developer.chrome.com/trunk/apps/manifest.html#permissions)
## APIs
@@ -1,15 +1,6 @@
-/**
- *
- * Mini Code Edit is designed to run on a Chrome OS device. It uses the
- * fileBrowserHandler API (http://code.google.com/chrome/extensions/fileBrowserHandler.html),
- * which is available only on Chrome OS. If that API isn't available, it uses the
- * chrome.fileSystem API, which isn't quite yet available on Chrome OS.
- *
- */
-
-// width 640 for font size 12
-// 720 for font size 14
chrome.experimental.app.onLaunched.addListener(function() {
+ // width 640 for font size 12
+ // 720 for font size 14
chrome.app.window.create('main.html', {
frame: 'chrome', width: 720, height: 400
});
View
@@ -1,21 +1,23 @@
# Sandbox
This sample creates a sandboxed iframe (`sandbox.html`) to which the main page (`mainpage.html`)
-passes a counter variable. The sandboxed page uses handlebars to evaluate and compose a message
+passes a counter variable. The sandboxed page uses the
+[Handlebars template library](http://handlebarsjs.com/) to evaluate and compose a message
using the counter variable which is then passed back to the main page for rendering.
-[CSP](http://developer.chrome.com/trunk/apps/app_csp.html) disallows the use
-of `eval` or `new Function` (or variations like Function.apply) so using a
+The default packaged app Content Security Policy (CSP) value
+[disallows](http://developer.chrome.com/trunk/apps/app_csp.html) the use of
+`eval()` or `new Function()` (or variants like `Function.apply()`) so using a
sandbox is necessary for this process. To enable sandboxing in your app you
-add the `sandbox` property to your app's [manifest file](http://code.google.com/chrome/extensions/manifest.html#sandbox).
+add the `sandbox` property to your app's [manifest file](http://developer.chrome.com/trunk/apps/manifest.html#sandbox).
-[See more info on using eval safely in Packaged Apps](http://developer.chrome.com/trunk/apps/sandboxingEval.html)
+See more info on [using eval safely in packaged apps](http://developer.chrome.com/trunk/apps/sandboxingEval.html).
## Permissions
* Experimental
-[See more on permissions](http://code.google.com/chrome/extensions/manifest.html#permissions)
+[See more on permissions](http://developer.chrome.com/trunk/apps/manifest.html#permissions)
## APIs
View
@@ -8,7 +8,7 @@ The app keeps track of its window in the background page. If none exists, or if
* Experimental
-[See more on permissions](http://code.google.com/chrome/extensions/manifest.html#permissions)
+[See more on permissions](http://developer.chrome.com/trunk/apps/manifest.html#permissions)
## APIs
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Diff not rendered.
View
Diff not rendered.
View
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,191 @@
+ /*
+ * TipTip
+ * Copyright 2010 Drew Wilson
+ * www.drewwilson.com
+ * code.drewwilson.com/entry/tiptip-jquery-plugin
+ *
+ * Version 1.3 - Updated: Mar. 23, 2010
+ *
+ * This Plug-In will create a custom tooltip to replace the default
+ * browser tooltip. It is extremely lightweight and very smart in
+ * that it detects the edges of the browser window and will make sure
+ * the tooltip stays within the current window size. As a result the
+ * tooltip will adjust itself to be displayed above, below, to the left
+ * or to the right depending on what is necessary to stay within the
+ * browser window. It is completely customizable as well via CSS.
+ *
+ * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
+(function($){
+ $.fn.tipTip = function(options) {
+ var defaults = {
+ activation: "hover",
+ keepAlive: false,
+ maxWidth: "200px",
+ edgeOffset: 3,
+ defaultPosition: "bottom",
+ delay: 400,
+ fadeIn: 200,
+ fadeOut: 200,
+ attribute: "title",
+ content: false, // HTML or String to fill TipTIp with
+ enter: function(){},
+ exit: function(){}
+ };
+ var opts = $.extend(defaults, options);
+
+ // Setup tip tip elements and render them to the DOM
+ if($("#tiptip_holder").length <= 0){
+ var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
+ var tiptip_content = $('<div id="tiptip_content"></div>');
+ var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
+ $("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));
+ } else {
+ var tiptip_holder = $("#tiptip_holder");
+ var tiptip_content = $("#tiptip_content");
+ var tiptip_arrow = $("#tiptip_arrow");
+ }
+
+ return this.each(function(){
+ var org_elem = $(this);
+ if(opts.content){
+ var org_title = opts.content;
+ } else {
+ var org_title = org_elem.attr(opts.attribute);
+ }
+ if(org_title != ""){
+ if(!opts.content){
+ org_elem.removeAttr(opts.attribute); //remove original Attribute
+ }
+ var timeout = false;
+
+ if(opts.activation == "hover"){
+ org_elem.hover(function(){
+ active_tiptip();
+ }, function(){
+ if(!opts.keepAlive){
+ deactive_tiptip();
+ }
+ });
+ if(opts.keepAlive){
+ tiptip_holder.hover(function(){}, function(){
+ deactive_tiptip();
+ });
+ }
+ } else if(opts.activation == "focus"){
+ org_elem.focus(function(){
+ active_tiptip();
+ }).blur(function(){
+ deactive_tiptip();
+ });
+ } else if(opts.activation == "click"){
+ org_elem.click(function(){
+ active_tiptip();
+ return false;
+ }).hover(function(){},function(){
+ if(!opts.keepAlive){
+ deactive_tiptip();
+ }
+ });
+ if(opts.keepAlive){
+ tiptip_holder.hover(function(){}, function(){
+ deactive_tiptip();
+ });
+ }
+ }
+
+ function active_tiptip(){
+ opts.enter.call(this);
+ tiptip_content.html(org_title);
+ tiptip_holder.hide().removeAttr("class").css("margin","0");
+ tiptip_arrow.removeAttr("style");
+
+ var top = parseInt(org_elem.offset()['top']);
+ var left = parseInt(org_elem.offset()['left']);
+ var org_width = parseInt(org_elem.outerWidth());
+ var org_height = parseInt(org_elem.outerHeight());
+ var tip_w = tiptip_holder.outerWidth();
+ var tip_h = tiptip_holder.outerHeight();
+ var w_compare = Math.round((org_width - tip_w) / 2);
+ var h_compare = Math.round((org_height - tip_h) / 2);
+ var marg_left = Math.round(left + w_compare);
+ var marg_top = Math.round(top + org_height + opts.edgeOffset);
+ var t_class = "";
+ var arrow_top = "";
+ var arrow_left = Math.round(tip_w - 12) / 2;
+
+ if(opts.defaultPosition == "bottom"){
+ t_class = "_bottom";
+ } else if(opts.defaultPosition == "top"){
+ t_class = "_top";
+ } else if(opts.defaultPosition == "left"){
+ t_class = "_left";
+ } else if(opts.defaultPosition == "right"){
+ t_class = "_right";
+ }
+
+ var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
+ var left_compare = (tip_w + left) > parseInt($(window).width());
+
+ if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
+ t_class = "_right";
+ arrow_top = Math.round(tip_h - 13) / 2;
+ arrow_left = -12;
+ marg_left = Math.round(left + org_width + opts.edgeOffset);
+ marg_top = Math.round(top + h_compare);
+ } else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
+ t_class = "_left";
+ arrow_top = Math.round(tip_h - 13) / 2;
+ arrow_left = Math.round(tip_w);
+ marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
+ marg_top = Math.round(top + h_compare);
+ }
+
+ var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
+ var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
+
+ if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
+ if(t_class == "_top" || t_class == "_bottom"){
+ t_class = "_top";
+ } else {
+ t_class = t_class+"_top";
+ }
+ arrow_top = tip_h;
+ marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
+ } else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
+ if(t_class == "_top" || t_class == "_bottom"){
+ t_class = "_bottom";
+ } else {
+ t_class = t_class+"_bottom";
+ }
+ arrow_top = -12;
+ marg_top = Math.round(top + org_height + opts.edgeOffset);
+ }
+
+ if(t_class == "_right_top" || t_class == "_left_top"){
+ marg_top = marg_top + 5;
+ } else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
+ marg_top = marg_top - 5;
+ }
+ if(t_class == "_left_top" || t_class == "_left_bottom"){
+ marg_left = marg_left + 5;
+ }
+ tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
+ tiptip_holder.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
+
+ if (timeout){ clearTimeout(timeout); }
+ timeout = setTimeout(function(){ tiptip_holder.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
+ }
+
+ function deactive_tiptip(){
+ opts.exit.call(this);
+ if (timeout){ clearTimeout(timeout); }
+ tiptip_holder.fadeOut(opts.fadeOut);
+ }
+ }
+ });
+ }
+})(jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 2e53281

Please sign in to comment.