seed r804 - in trunk: examples tools
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r804 - in trunk: examples tools
- Date: Sun, 25 Jan 2009 09:47:14 +0000 (UTC)
Author: hortont
Date: Sun Jan 25 09:47:14 2009
New Revision: 804
URL: http://svn.gnome.org/viewvc/seed?rev=804&view=rev
Log:
Most of the examples pass JSLint now; JSLint now accepts "const".
Modified:
trunk/examples/accelgroup.js
trunk/examples/actions.js
trunk/examples/async-quine.js
trunk/examples/calculator.js
trunk/examples/clutter-cogl.js
trunk/examples/clutter.js
trunk/examples/gdkpixbufloader.js
trunk/examples/gtkplug.js
trunk/examples/n-oscillator.js
trunk/examples/poppler.js
trunk/examples/quine.js
trunk/examples/vte-test.js
trunk/tools/jslint.js
Modified: trunk/examples/accelgroup.js
==============================================================================
--- trunk/examples/accelgroup.js (original)
+++ trunk/examples/accelgroup.js Sun Jan 25 09:47:14 2009
@@ -10,7 +10,7 @@
var quit = function ()
{
main_quit();
- }
+ };
var w = new Window();
w.signal.hide.connect(quit);
Modified: trunk/examples/actions.js
==============================================================================
--- trunk/examples/actions.js (original)
+++ trunk/examples/actions.js Sun Jan 25 09:47:14 2009
@@ -6,7 +6,7 @@
with(Gtk)
{
var window = new Window();
- window.signal.hide.connect(function () { main_quit() });
+ window.signal.hide.connect(function () { main_quit(); });
var toolbar = new Toolbar();
var vbox = new VBox();
window.add(vbox);
Modified: trunk/examples/async-quine.js
==============================================================================
--- trunk/examples/async-quine.js (original)
+++ trunk/examples/async-quine.js Sun Jan 25 09:47:14 2009
@@ -1,8 +1,8 @@
-#!/usr/local/bin/seed
+#!/usr/bin/env seed
+
Seed.import_namespace("GLib");
Seed.import_namespace("Gio");
-
var file = Gio.file_new_for_path("./async-quine.js");
file.read_async(0, null, function(source, result)
Modified: trunk/examples/calculator.js
==============================================================================
--- trunk/examples/calculator.js (original)
+++ trunk/examples/calculator.js Sun Jan 25 09:47:14 2009
@@ -6,14 +6,13 @@
Gtk.init(null, null);
-var window, label;
var calc_val = "";
function update_display()
{
label.set_markup("<span size='30000'>" + calc_val + "</span>");
- if(calc_val == "")
+ if(calc_val === "")
{
label.set_markup("<span size='30000'>0</span>");
}
@@ -53,14 +52,14 @@
function pressed_number(button)
{
- calc_val = (((calc_val == 0) ? "" : calc_val) + button.label);
+ calc_val = (((calc_val === 0) ? "" : calc_val) + button.label);
update_display();
}
function swap_sign(button)
{
calc_val = ((calc_val[0] == "-") ?
- calc_val.substring(1) : "-" + calc_val)
+ calc_val.substring(1) : "-" + calc_val);
update_display();
}
Modified: trunk/examples/clutter-cogl.js
==============================================================================
--- trunk/examples/clutter-cogl.js (original)
+++ trunk/examples/clutter-cogl.js Sun Jan 25 09:47:14 2009
@@ -32,15 +32,19 @@
return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
else if (time < (2/2.75))
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(1.5/2.75))*time+.75);
+ (time-=(1.5/2.75))*time+0.75);
else if (time < (2.5/2.75))
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(2.25/2.75))*time+.9375);
+ (time-=(2.25/2.75))*time+0.9375);
else
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(2.625/2.75))*time+.984375);
+ (time-=(2.625/2.75))*time+0.984375);
}
+Clutter.init(null, null);
+
+var template = new Clutter.EffectTemplate.for_duration(RIPPLE_S, alpha_func);
+
function destroy_actor(actor)
{
actor.destroy();
@@ -100,10 +104,6 @@
}
}
-Clutter.init(null, null);
-
-var template = new Clutter.EffectTemplate.for_duration(RIPPLE_S, alpha_func);
-
var stage = new Clutter.Stage();
stage.width = SCREEN_W;
Modified: trunk/examples/clutter.js
==============================================================================
--- trunk/examples/clutter.js (original)
+++ trunk/examples/clutter.js Sun Jan 25 09:47:14 2009
@@ -29,17 +29,17 @@
return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
else if (time < (2/2.75))
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(1.5/2.75))*time+.75);
+ (time-=(1.5/2.75))*time+0.75);
else if (time < (2.5/2.75))
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(2.25/2.75))*time+.9375);
+ (time-=(2.25/2.75))*time+0.9375);
else
return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
- (time-=(2.625/2.75))*time+.984375);
+ (time-=(2.625/2.75))*time+0.984375);
}
var stage = new Clutter.Stage();
-stage.signal.hide.connect(function(){Clutter.main_quit()});
+stage.signal.hide.connect(function(){Clutter.main_quit();});
var timeline = new Clutter.Timeline({fps:60, num_frames:300});
stage.show_all();
Modified: trunk/examples/gdkpixbufloader.js
==============================================================================
--- trunk/examples/gdkpixbufloader.js (original)
+++ trunk/examples/gdkpixbufloader.js Sun Jan 25 09:47:14 2009
@@ -1,4 +1,5 @@
-#!/usr/local/bin/seed
+#!/usr/bin/env seed
+
Seed.import_namespace("GLib");
Seed.import_namespace("Gio");
Seed.import_namespace("GdkPixbuf");
Modified: trunk/examples/gtkplug.js
==============================================================================
--- trunk/examples/gtkplug.js (original)
+++ trunk/examples/gtkplug.js Sun Jan 25 09:47:14 2009
@@ -7,7 +7,7 @@
var child_pid = Seed.fork();
-if (child_pid == 0)
+if (child_pid === 0)
{
Gtk.init(null, null);
Modified: trunk/examples/n-oscillator.js
==============================================================================
--- trunk/examples/n-oscillator.js (original)
+++ trunk/examples/n-oscillator.js Sun Jan 25 09:47:14 2009
@@ -5,7 +5,7 @@
Gst.init(null, null);
Gtk.init(null, null);
-// This is a really ugly program.
+// This is a really ugly program. Please fix it.
function oscillator(freq)
{
@@ -32,13 +32,11 @@
var playing = false;
- var adjustment = vscale.adjustment;
- adjustment.upper = 3000;
- adjustment.value = freq;
-
- var adjustment = volscale.adjustment;
- adjustment.upper = 10;
- adjustment.value = volume.volume;
+ vscale.adjustment.upper = 3000;
+ vscale.adjustment.value = freq;
+
+ volscale.adjustment.upper = 10;
+ volscale.adjustment.value = volume.volume;
hbox.pack_start(vscale, true, true, 10);
hbox.pack_start(volscale, true, true, 10);
@@ -47,7 +45,7 @@
var toggle = function(button, that)
{
- if (playing == false)
+ if (playing === false)
{
pipeline.set_state(Gst.State.PLAYING);
playing = true;
@@ -57,15 +55,18 @@
pipeline.set_state(Gst.State.PAUSED);
playing = false;
}
- }
+ };
+
var update_freq = function(range)
{
audiosrc.freq = range.get_value();
- }
+ };
+
var update_vol = function(range)
{
volume.volume = range.get_value();
- }
+ };
+
button.signal.clicked.connect(toggle);
vscale.signal.value_changed.connect(update_freq);
volscale.signal.value_changed.connect(update_vol);
Modified: trunk/examples/poppler.js
==============================================================================
--- trunk/examples/poppler.js (original)
+++ trunk/examples/poppler.js Sun Jan 25 09:47:14 2009
@@ -15,7 +15,7 @@
function draw_document()
{
- if (current_page != null)
+ if (current_page !== null)
{
drawing_area.window.clear();
cairo = Gdk.cairo_create(drawing_area.window);
@@ -27,6 +27,12 @@
function set_page(num)
{
+ if(num < 0)
+ {
+ set_page(0);
+ return;
+ }
+
if(num >= num_pages)
{
set_page(num_pages - 1);
@@ -45,10 +51,10 @@
else
next_button.sensitive = true;
- if (page_num == 0)
- previous_button.sensitive = false;
- else
+ if (page_num)
previous_button.sensitive = true;
+ else
+ previous_button.sensitive = false;
}
function open_file(sv)
@@ -96,7 +102,7 @@
entry = new Gtk.Entry({text:"0"});
entry_item.add(entry);
entry_item.width_request = 40;
- entry.signal.activate.connect(function(){set_page(parseInt(entry.text, 10)-1)});
+ entry.signal.activate.connect(function(){set_page(parseInt(entry.text, 10)-1);});
var label_item = new Gtk.ToolItem();
page_label = new Gtk.Label({label: " of 0"});
label_item.add(page_label);
@@ -139,7 +145,7 @@
main_vbox.pack_start(toolbar);
main_vbox.pack_start(drawing_area, true, true);
-window.signal.hide.connect(function () {Gtk.main_quit()});
+window.signal.hide.connect(function () {Gtk.main_quit();});
window.show_all();
window.resize(600,800);
Modified: trunk/examples/quine.js
==============================================================================
--- trunk/examples/quine.js (original)
+++ trunk/examples/quine.js Sun Jan 25 09:47:14 2009
@@ -1,7 +1,7 @@
#!/usr/bin/env seed
Seed.import_namespace("Gio");
-file = Gio.file_new_for_path(Seed.argv[1])
+file = Gio.file_new_for_path(Seed.argv[1]);
input = file.read();
//get_contents is an addition in extensions/Gio.js to make life easier.
Seed.print(input.get_contents());
Modified: trunk/examples/vte-test.js
==============================================================================
--- trunk/examples/vte-test.js (original)
+++ trunk/examples/vte-test.js Sun Jan 25 09:47:14 2009
@@ -14,7 +14,7 @@
var vte = new Vte.Terminal();
vte.fork_command("/bin/bash");
- vte.signal.child_exited.connect(function(){main_quit()});
+ vte.signal.child_exited.connect(function(){main_quit();});
vte.signal.window_title_changed.connect
(function(terminal)
{
Modified: trunk/tools/jslint.js
==============================================================================
--- trunk/tools/jslint.js (original)
+++ trunk/tools/jslint.js Sun Jan 25 09:47:14 2009
@@ -4129,6 +4129,7 @@
stmt('var', varstatement);
+ stmt('const', varstatement);
stmt('new', function () {
error("'new' should not be used as a statement.");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]