wnw_show 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,10 +81,17 @@ if (!wnw.show) wnw.show = {};
81
81
  function addImg(url){
82
82
  wnw.show.Slider.addNewImg(url);
83
83
  };
84
+ var assetPath = function(name) {
85
+ // for wnw rails environment
86
+ //return "<%= asset_path('wnw_show/show/" + name + "') %>";
87
+ // for local test
88
+ return "/wnw_show/vendor/assets/images/wnw_show/show/" + name;
89
+ };
84
90
  //publicフィールド・関数定義
85
91
  wnw.show.start = start;
86
92
  wnw.show.libPath = libPath;
87
93
  wnw.show.addImg = addImg;
94
+ wnw.show.assetPath = assetPath;
88
95
  })();
89
96
 
90
97
  //--------------------------------------------------
@@ -92,6 +99,7 @@ if (!wnw.show) wnw.show = {};
92
99
  //--------------------------------------------------
93
100
  if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
94
101
  (function(){
102
+
95
103
  function log(str){
96
104
  console.log("[wnw.show.InitAnime] " + str);
97
105
  };
@@ -112,7 +120,7 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
112
120
  return (this.img.width() >= 24);
113
121
  };
114
122
  Back.prototype.show = function(){
115
- log("view" + this.src);
123
+ log("show:" + this.src);
116
124
  this.img.css({"position" : "absolute",
117
125
  "top":this.position.top,
118
126
  "left":this.position.left,
@@ -122,9 +130,23 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
122
130
  this.img.animate({"opacity":this.opacity},FADEIN_TIME);
123
131
  };
124
132
  Back.prototype.hide = function(){
125
- log("hide" + this.src);
133
+ log("hide:" + this.src);
126
134
  this.img.animate({"opacity":0},FADEIN_TIME);
127
135
  };
136
+ Back.prototype.showQuick = function(){
137
+ log("showQuick:" + this.src);
138
+ this.img.css({"position" : "absolute",
139
+ "top":this.position.top,
140
+ "left":this.position.left,
141
+ "width":this.position.width,
142
+ "height":this.position.height,
143
+ "z-index":this.zIndex});
144
+ this.img.css({"opacity":this.opacity});
145
+ };
146
+ Back.prototype.hideQuick = function(){
147
+ log("hideQuick:" + this.src);
148
+ this.img.hide();
149
+ };
128
150
 
129
151
  FADEIN_TIME = 3000;
130
152
 
@@ -144,30 +166,48 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
144
166
 
145
167
  var gBacks = new Array();
146
168
  var callbackFunction ;
169
+ var gSkip = false;//スキップするかどうか
147
170
 
148
171
  function start(msg,callback,topImageUrl,logoUrl){
149
172
  log("initAnime start");
150
173
  typeCharMessage=msg;
151
174
  callbackFunction = callback;
175
+ $("body").append(
176
+ $("<div/>")
177
+ .attr("id","skip")
178
+ .html("click to SKIP")
179
+ .css({"position":"absolute",
180
+ "text-decoration":"underline",
181
+ "color" : "#FF8080",
182
+ "font-size" : 24,
183
+ "top":10,
184
+ "left":10,
185
+ "z-index":1000})
186
+ .click(function(){
187
+ log("skip");
188
+ gSkip=true;
189
+ skipInitAnime();
190
+ })
191
+ );
152
192
  log("callbackFunction:" + callbackFunction);
153
193
  log("wnw.show.LibPath:" + wnw.show.libPath());
154
- gBacks[0]=new Back(new Position(10,10,1200,750) , "<%= asset_path('wnw_show/show/background.png') %>",0,1);//背景のピンクの四角
155
- gBacks[1]=new Back(new Position(61,385,178,495) , "<%= asset_path('wnw_show/show/env0.gif') %>",0,1);
156
- gBacks[2]=new Back(new Position(277,349,392,435) , "<%= asset_path('wnw_show/show/env1.gif') %>",0,1);
157
- gBacks[3]=new Back(new Position(430,138,995,563) , "<%= asset_path('wnw_show/show/env2.gif') %>",0,1);
158
- gBacks[4]=new Back(new Position(1024,337,1135,433) , "<%= asset_path('wnw_show/show/env3.gif') %>",0,1);
159
- gBacks[5]=new Back(new Position(234,203,356,302) , "<%= asset_path('wnw_show/show/env4.gif') %>",0,1);
160
- gBacks[6]=new Back(new Position(679,83,760,136) , "<%= asset_path('wnw_show/show/env5.gif') %>",0,1);
161
- gBacks[7]=new Back(new Position(885,40,992,117) , "<%= asset_path('wnw_show/show/env6.gif') %>",0,1);
162
- gBacks[8]=new Back(new Position(125,615,259,680) , "<%= asset_path('wnw_show/show/env7.gif') %>",0,1);
163
- gBacks[9]=new Back(new Position(279,521,374,597) , "<%= asset_path('wnw_show/show/env8.gif') %>",0,1);
164
- gBacks[10]=new Back(new Position(458,602,546,651) , "<%= asset_path('wnw_show/show/env9.gif') %>",0,1);
165
- gBacks[11]=new Back(new Position(602,569,688,641) , "<%= asset_path('wnw_show/show/env10.gif') %>",0,1);
166
- gBacks[12]=new Back(new Position(801,576,917,672) , "<%= asset_path('wnw_show/show/env11.gif') %>",0,1);
167
- gBacks[13]=new Back(new Position(968,641,1070,740) , "<%= asset_path('wnw_show/show/env12.gif') %>",0,1);
168
- gBacks[14]=new Back(new Position(10,10,800,210) , "<%= asset_path('wnw_show/show/kirakira2.gif') %>",255,1);
169
- gBacks[15]=new Back(new Position(430,148,995,563) , topImageUrl ,1,1);
170
- gBacks[16]=new Back(new Position(30,480,300,300) , logoUrl ,255,0.7);
194
+ gBacks[0]=new Back(new Position(10,10,1200,750) , wnw.show.assetPath('background.png'),0,1);//背景のピンクの四角
195
+ gBacks[1]=new Back(new Position(61,385,178,495) , wnw.show.assetPath('env0.gif'),0,1);
196
+ gBacks[2]=new Back(new Position(277,349,392,435) , wnw.show.assetPath('env1.gif'),0,1);
197
+ gBacks[3]=new Back(new Position(430,138,995,563) , wnw.show.assetPath('env2.gif'),0,1);
198
+ gBacks[4]=new Back(new Position(1024,337,1135,433) , wnw.show.assetPath('env3.gif'),0,1);
199
+ gBacks[5]=new Back(new Position(234,203,356,302) , wnw.show.assetPath('env4.gif'),0,1);
200
+ gBacks[6]=new Back(new Position(679,83,760,136) , wnw.show.assetPath('env5.gif'),0,1);
201
+ gBacks[7]=new Back(new Position(885,40,992,117) , wnw.show.assetPath('env6.gif'),0,1);
202
+ gBacks[8]=new Back(new Position(125,615,259,680) , wnw.show.assetPath('env7.gif'),0,1);
203
+ gBacks[9]=new Back(new Position(279,521,374,597) , wnw.show.assetPath('env8.gif'),0,1);
204
+ gBacks[10]=new Back(new Position(458,602,546,651) , wnw.show.assetPath('env9.gif'),0,1);
205
+ gBacks[11]=new Back(new Position(602,569,688,641) , wnw.show.assetPath('env10.gif'),0,1);
206
+ gBacks[12]=new Back(new Position(801,576,917,672) , wnw.show.assetPath('env11.gif'),0,1);
207
+ gBacks[13]=new Back(new Position(968,641,1070,740) , wnw.show.assetPath('env12.gif'),0,1);
208
+ gBacks[14]=new Back(new Position(10,10,800,210) , wnw.show.assetPath('kirakira2.gif'),255,1);//左上のキラキラ
209
+ gBacks[15]=new Back(new Position(430,148,995,563) , topImageUrl ,1,1);//最初の写真
210
+ gBacks[16]=new Back(new Position(30,480,300,300) , logoUrl ,255,0.7);//ロゴ
171
211
  loadStep1();
172
212
  };
173
213
 
@@ -196,7 +236,9 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
196
236
  function loadStep2(){
197
237
  gBacks[0].show(); // 背景
198
238
  gBacks[14].show(); // キラキラ
199
- setTimeout(loadStep3,ANIME_SPAN);
239
+ if( ! gSkip){
240
+ setTimeout(loadStep3,ANIME_SPAN);
241
+ }
200
242
  };
201
243
 
202
244
  //封筒がふわっと現れるアニメーション
@@ -205,7 +247,9 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
205
247
  gBacks[4].show();
206
248
  gBacks[7].show();
207
249
  gBacks[13].show();
208
- setTimeout(loadStep5,ANIME_SPAN);
250
+ if( ! gSkip){
251
+ setTimeout(loadStep5,ANIME_SPAN);
252
+ }
209
253
  };
210
254
 
211
255
  //封筒がふわっと現れるアニメーション
@@ -216,13 +260,18 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
216
260
  gBacks[6].show();
217
261
  gBacks[9].show();
218
262
  // gBacks[8].show();
219
- setTimeout(loadStep6,ANIME_SPAN);
263
+ if( ! gSkip){
264
+ setTimeout(loadStep6,ANIME_SPAN);
265
+ }
220
266
  };
221
267
 
222
268
  //写真がふわっと現れるアニメーション
223
269
  function loadStep6(){
224
270
  gBacks[15].show();//写真
225
- setTimeout(loadStep7,ANIME_SPAN);
271
+ $("#skip").animate({"opacity":0},ANIME_SPAN);
272
+ if( ! gSkip){
273
+ setTimeout(loadStep7,ANIME_SPAN);
274
+ }
226
275
  };
227
276
 
228
277
  //文字表示
@@ -246,22 +295,26 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
246
295
  $("body").append(typeCharDiv);
247
296
  loadStep8(0);
248
297
 
249
- setTimeout(loadStep9,PHOTO_SPAN);
250
-
298
+ if( ! gSkip){
299
+ setTimeout(loadStep9,PHOTO_SPAN);
300
+ }
251
301
  };
252
302
 
253
303
  //文字表示のサブ関数。一文字づつ描画
254
304
  function loadStep8(counter){
255
- if (counter > typeCharMessage.length){
256
- typeCharDiv.html(typeCharMessage);
257
- }else if(typeCharMessage.charAt(counter) == '/'){
258
- setTimeout(loadStep8, TYPE_CHAR_NL_TIME, counter+1);
259
- }else{
260
- $("#str_div").html(typeCharMessage.substring(0,counter)+TYPE_CHAR_CURSOLE);
261
- setTimeout(loadStep8,TYPE_CHAR_SPEED,counter+1);
262
- }
305
+ if( ! gSkip){
306
+ if (counter > typeCharMessage.length){
307
+ typeCharDiv.html(typeCharMessage);
308
+ }else if(typeCharMessage.charAt(counter) == '/'){
309
+ setTimeout(loadStep8, TYPE_CHAR_NL_TIME, counter+1);
310
+ }else{
311
+ $("#str_div").html(typeCharMessage.substring(0,counter)+TYPE_CHAR_CURSOLE);
312
+ setTimeout(loadStep8,TYPE_CHAR_SPEED,counter+1);
313
+ }
314
+ }
263
315
  };
264
316
 
317
+ //写真を消して、残りの封筒を表示して、コールバックを呼び出す
265
318
  function loadStep9(){
266
319
  typeCharDiv.animate({"opacity":0},FADEIN_TIME);
267
320
  gBacks[15].hide();//写真
@@ -269,10 +322,32 @@ if (!wnw.show.InitAnime) wnw.show.InitAnime = {};
269
322
  gBacks[10].show();
270
323
  gBacks[11].show();
271
324
  gBacks[12].show();
272
-
273
325
  callbackFunction();
274
326
  };
275
327
 
328
+
329
+ //スキップ
330
+ function skipInitAnime(){
331
+ $("#skip").hide();
332
+ $("#str_div").hide();
333
+ gBacks[1].showQuick();
334
+ gBacks[2].showQuick();
335
+ gBacks[3].showQuick();
336
+ gBacks[4].showQuick();
337
+ gBacks[5].showQuick();
338
+ gBacks[6].showQuick();
339
+ gBacks[7].showQuick();
340
+ gBacks[8].showQuick();
341
+ gBacks[9].showQuick();
342
+ gBacks[10].showQuick();
343
+ gBacks[11].showQuick();
344
+ gBacks[12].showQuick();
345
+ gBacks[13].showQuick();
346
+ gBacks[15].hideQuick();
347
+ gBacks[16].showQuick();
348
+ callbackFunction();
349
+ }
350
+
276
351
  //public関数の定義
277
352
  wnw.show.InitAnime.start = start;
278
353
 
@@ -441,7 +516,7 @@ if (!wnw.show.Slider) wnw.show.Slider = {};
441
516
  if(gConList[i].nextDeleteFlag){
442
517
  log("既存キューに追加 " + gConList[i].imgJq.attr("src") );
443
518
  gOldImgJqQueue.enqueue(gConList[i].imgJq);
444
- log("古いコンテナ削除");
519
+ log("古コンテナ削除");
445
520
  gConList.splice(i,1);
446
521
  }
447
522
  }
@@ -588,7 +663,7 @@ if (!wnw.show.Tori) wnw.show.Tori = {};
588
663
  //音楽再生
589
664
  function playSound(){
590
665
  //鳥の鳴き声
591
- var swfURL = "<%= asset_path 'wnw_show/show/SoundUnit.swf' %>";
666
+ var swfURL = wnw.show.assetPath('SoundUnit.swf');
592
667
  var div = document.getElementById("SoundUnit");
593
668
  var innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="SoundUnit"><param name="movie" value="' + swfURL + '" /><embed src="' + swfURL + '" width="0" height="0" name="SoundUnit" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
594
669
  div.innerHTML = innerHTML;
@@ -596,8 +671,8 @@ if (!wnw.show.Tori) wnw.show.Tori = {};
596
671
 
597
672
  function fly(){
598
673
  //トリ画像
599
- var TORI_IMAGE= "<%= asset_path('wnw_show/show/tori.png') %>";
600
- var NULL_IMAGE = "<%= asset_path('wnw_show/show/null.gif') %>";
674
+ var TORI_IMAGE= wnw.show.assetPath('tori.png');
675
+ var NULL_IMAGE = wnw.show.assetPath('null.gif');
601
676
  if (already_init == false){
602
677
  $("body")
603
678
  .append($("<img/>")
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file