Presentation.st 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. Widget subclass: #Slide
  2. instanceVariableNames: 'presentation'
  3. category: 'Presentation'!
  4. !Slide methodsFor: 'accessing'!
  5. presentation
  6. ^presentation
  7. !
  8. presentation: aPresentation
  9. presentation := aPresentation
  10. !
  11. id
  12. self subclassResponsibility
  13. !
  14. cssClass
  15. ^'slide'
  16. !
  17. backgroundColor
  18. ^'#555'
  19. ! !
  20. !Slide methodsFor: 'actions'!
  21. show
  22. document location hash: self id.
  23. self backgroundColor ifNotNil: [
  24. (window jQuery: '#slides') css: 'background' color: self backgroundColor].
  25. (window jQuery: '.slide') hide: self presentation slideTransition options: #() duration: 300.
  26. (window jQuery: '#', self id) show: self presentation slideTransition options: #() duration: 300.
  27. ! !
  28. !Slide methodsFor: 'rendering'!
  29. renderOn: html
  30. html div class: self cssClass; id: self id; with: [
  31. self renderSlideOn: html.
  32. self renderMetaOn: html]
  33. !
  34. renderSlideOn: html
  35. !
  36. renderMetaOn: html
  37. html div
  38. id: 'meta';
  39. with: [
  40. html p class: 'title'; with: self presentation title.
  41. html p class: 'description'; with: self presentation description.
  42. html a class: 'author'; with: self presentation author; href: 'mailto:', self presentation email.
  43. html a class: 'url'; with: self presentation url; href: self presentation url]
  44. ! !
  45. !Slide class methodsFor: 'instance creation'!
  46. on: aPresentation
  47. ^self new
  48. presentation: aPresentation;
  49. yourself
  50. ! !
  51. Widget subclass: #Presentation
  52. instanceVariableNames: 'currentSlide slides'
  53. category: 'Presentation'!
  54. !Presentation methodsFor: 'accessing'!
  55. title
  56. ^ self class title.
  57. !
  58. author
  59. ^'John Smith'
  60. !
  61. url
  62. ^'http://jtalk-project.org'
  63. !
  64. description
  65. ^'A presentation written in Jtalk'
  66. !
  67. email
  68. ^'john@smith.com'
  69. !
  70. slides
  71. slides ifNil: [self initSlides].
  72. ^slides
  73. !
  74. slideClasses
  75. ^self subclassResponsibility
  76. !
  77. currentSlide
  78. ^currentSlide
  79. !
  80. currentSlide: aSlide
  81. currentSlide := aSlide
  82. !
  83. slideTransition
  84. ^'fade'
  85. !
  86. style
  87. "Should return a CSS style"
  88. ^ ''
  89. ! !
  90. !Presentation methodsFor: 'actions'!
  91. nextSlide
  92. | next |
  93. self currentSlide ifNotNil: [
  94. next := self slides
  95. at: (self slides indexOf: self currentSlide) + 1
  96. ifAbsent: [nil].
  97. next ifNotNil: [currentSlide := next. next show]]
  98. !
  99. showCurrentSlide
  100. self currentSlide ifNotNil: [
  101. '.slide' asJQuery hide.
  102. ('#', self currentSlide id) asJQuery show.
  103. 'title' asJQuery text: self title, ' - ', self currentSlide id.
  104. ]
  105. !
  106. previousSlide
  107. | next |
  108. self currentSlide ifNotNil: [
  109. next := self slides
  110. at: (self slides indexOf: self currentSlide) - 1
  111. ifAbsent: [nil].
  112. next ifNotNil: [currentSlide := next. next show]]
  113. !
  114. checkHash
  115. | hash slide |
  116. hash := document location hash replace: '^#' with: ''.
  117. slide := self slides detect: [:each | each id = hash] ifNone: [nil].
  118. slide ifNotNil: [
  119. self currentSlide = slide ifFalse: [
  120. self currentSlide: slide.
  121. slide show]]
  122. ! !
  123. !Presentation methodsFor: 'initialization'!
  124. initSlides
  125. slides := self slideClasses collect: [:each | each on: self]
  126. ! !
  127. !Presentation methodsFor: 'rendering'!
  128. renderOn: html
  129. html style
  130. type: 'text/css';
  131. with: self style.
  132. html div
  133. id: 'slides';
  134. with: [self renderSlidesOn: html]
  135. !
  136. renderSlidesOn: html
  137. self slides do: [:each |
  138. each renderOn: html].
  139. currentSlide ifNil: [currentSlide := self slides first].
  140. self showCurrentSlide
  141. ! !
  142. Presentation class instanceVariableNames: 'current'!
  143. !Presentation class methodsFor: 'accessing'!
  144. concretePresentations
  145. ^ self allSubclasses select: [:aPresentationClass| aPresentationClass isConcrete]
  146. !
  147. title
  148. ^ 'Slides'
  149. ! !
  150. !Presentation class methodsFor: 'enumerating'!
  151. concretePresentationsDo: aBlockWithArg
  152. self concretePresentations do: aBlockWithArg.
  153. ! !
  154. !Presentation class methodsFor: 'testing'!
  155. isConcrete
  156. ^false
  157. ! !
  158. Presentation subclass: #ESUG2011Presentation
  159. instanceVariableNames: ''
  160. category: 'Presentation'!
  161. !ESUG2011Presentation methodsFor: 'accessing'!
  162. description
  163. ^'ESUG 2011, Edinburgh'
  164. !
  165. author
  166. ^'Nicolas Petton'
  167. !
  168. email
  169. ^'nico@objectfusion.fr'
  170. !
  171. url
  172. ^'http://jtalk-project.org'
  173. !
  174. slideClasses
  175. ^Array new
  176. add: IntroSlide;
  177. add: AboutSlide;
  178. add: WhatIsJtalkSlide;
  179. add: JtalkFeaturesSlide;
  180. add: WorkspaceSlide;
  181. add: IDESlide;
  182. add: CountersSlide;
  183. add: JtalkAndJavascriptSlide;
  184. add: JtalkAndJavascriptSlide2;
  185. add: JtalkAndJavascriptSlide3;
  186. add: JtalkAndJavascriptSlide4;
  187. add: JtalkAndCLI;
  188. add: JtalkAndNode;
  189. add: JtalkAndNode2;
  190. add: JtalkAndNode3;
  191. add: JtalkAndWebOS;
  192. add: JtalkAndEnyo;
  193. add: ContributionsSlide;
  194. yourself
  195. !
  196. style
  197. ^'
  198. body {
  199. font-family: Helvetica,Arial,sans;
  200. }
  201. #slides {
  202. width: 100%;
  203. height: 100%;
  204. overflow: hidden;
  205. position: absolute;
  206. top: 0;
  207. bottom: 0;
  208. left: 0;
  209. right: 0;
  210. background: #555;
  211. }
  212. .slide {
  213. background: #fff;
  214. color: #444;
  215. text-align: left;
  216. font-size: 20px;
  217. line-height: 1.8em;
  218. height: 500px;
  219. width: 700px;
  220. padding: 60px;
  221. position: absolute;
  222. left: 50%;
  223. top: 50%;
  224. margin-left: -420px;
  225. margin-top: -320px;
  226. box-shadow: 0 0 20px #111;
  227. -moz-box-shadow: 0 0 20px #111;
  228. -webkit-box-shadow: 0 0 20px #111;
  229. }
  230. .slide.transparent {
  231. background: transparent;
  232. box-shadow: 0 0 0 none;
  233. -moz-box-shadow: 0 0 0 transparent;
  234. -webkit-box-shadow: 0 0 0 transparent;
  235. color: #fff !!important;
  236. }
  237. .slide.black {
  238. background: black;
  239. background-image: -webkit-gradient(
  240. linear,
  241. left bottom,
  242. left top,
  243. color-stop(0.38, rgb(79,79,79)),
  244. color-stop(0.69, rgb(33,33,33)),
  245. color-stop(0.86, rgb(4,4,4))
  246. );
  247. background-image: -moz-linear-gradient(
  248. center bottom,
  249. rgb(79,79,79) 38%,
  250. rgb(33,33,33) 69%,
  251. rgb(4,4,4) 86%
  252. );
  253. color: #fff !!important;
  254. }
  255. .slide.black h1, .slide.black h2, .slide.black h3,
  256. .slide.transparent h1, .slide.transparent h2, .slide.transparent h3 {
  257. color: #fff;
  258. text-shadow: 0 1px 4px #aaa;
  259. }
  260. .slide.black a, .slide.transparent a {
  261. color: #ccc;
  262. }
  263. .slide.white {
  264. color: #333 !!important;
  265. }
  266. .slide.white h1, .slide.white h2, .slide.white h3 {
  267. color: #333;
  268. }
  269. .slide.white a {
  270. color: #333;
  271. }
  272. .slide h1, .slide h2, .slide h3 {
  273. color: #333;
  274. /* text-align: center; */
  275. }
  276. .slide h1 {
  277. font-family: "Droid Sans";
  278. font-size: 36px;
  279. text-shadow: 0 1px 4px #aaa;
  280. margin-top: 30px;
  281. margin-bottom: 50px;
  282. }
  283. /* .slide ul, .slide li { */
  284. /* padding: 0; */
  285. /* margin: 0; */
  286. /* } */
  287. .slide button {
  288. font-size: 18px;
  289. }
  290. .slide a {
  291. color: #555;
  292. text-decoration: none;
  293. cursor: pointer;
  294. }
  295. .slide a:hover {
  296. color: #fff;
  297. background: #555;
  298. }
  299. .slide .right {
  300. text-align: right;
  301. }
  302. .slide .section.center {
  303. text-align: center;
  304. display: table-cell;
  305. vertical-align: middle;
  306. width: 700px;
  307. height: 500px;
  308. }
  309. .slide code {
  310. font-family: "Droid Sans Mono";
  311. color: #444;
  312. border: 1px solid #ddd;
  313. background: #eee;
  314. border-radius: 4px;
  315. padding: 2px;
  316. font-size: 16px;
  317. }
  318. .slide .code2 {
  319. font-family: "Droid Sans Mono";
  320. line-height: 1.2em;
  321. color: #444;
  322. padding: 2px;
  323. font-size: 16px;
  324. }
  325. .slide .CodeMirror {
  326. width: 500px;
  327. height: 300px;
  328. text-align: left;
  329. }
  330. .slide .CodeMirror-scroll {
  331. text-align: left;
  332. }
  333. .slide .fancy {
  334. margin-top: 30px;
  335. -webkit-transform: rotate(-10deg);
  336. -moz-transform: rotate(-10deg);
  337. transform: rotate(-10deg);
  338. color: red;
  339. }
  340. .slide .comment {
  341. opacity: 0.6;
  342. font-weight: normal;
  343. }
  344. .slide .red {
  345. color: red;
  346. }
  347. .slide .blue {
  348. color: blue;
  349. }
  350. .slide#WhatIsJtalk {
  351. background: white url("esug2011/images/balloon.jpg") 650px 50px no-repeat;
  352. }
  353. .slide#ide {
  354. background: black url("esug2011/images/ide_star_wars.png") center center no-repeat;
  355. }
  356. .slide#JtalkAndCLI {
  357. background: white url("esug2011/images/terminal.png") 620px 20px no-repeat;
  358. }
  359. .slide#JtalkAndNode {
  360. background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
  361. }
  362. .slide#JtalkAndNode2 {
  363. background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
  364. }
  365. .slide#JtalkAndNode3 {
  366. background: white url("esug2011/images/nodejs.png") 580px 40px no-repeat;
  367. }
  368. .slide#JtalkAndWebOS {
  369. background: white url("esug2011/images/devices.jpg") 380px 280px no-repeat;
  370. }
  371. .slide#JtalkAndEnyo {
  372. background: white url("esug2011/images/enyo.png") 130px 150px no-repeat;
  373. }
  374. .slide#links {
  375. background: white url("esug2011/images/asterix.png") 30px 130px no-repeat;
  376. }
  377. .slide#links .section {
  378. margin-left: 250px;
  379. margin-top: 200px;
  380. font-family: "Droid Sans";
  381. font-size: 26px;
  382. font-weight: bold;
  383. }
  384. #meta {
  385. position: absolute;
  386. font-size: 12px;
  387. opacity: 0.6;
  388. bottom: 0;
  389. right: 0;
  390. z-index: 2;
  391. background: #333;
  392. text-align: right;
  393. padding: 0 10px;
  394. line-height: 1.8em;
  395. color: #eee;
  396. border-top-left-radius: 5px;
  397. }
  398. #meta:hover {
  399. opacity: 0.8;
  400. }
  401. #meta p {
  402. display: inline;
  403. padding: 0 5px;
  404. }
  405. #meta a {
  406. //background: #ccc;
  407. color: #ccc;
  408. text-decoration: none;
  409. padding: 0 5px;
  410. }
  411. .slide {
  412. }
  413. '
  414. ! !
  415. ESUG2011Presentation class instanceVariableNames: 'current'!
  416. !ESUG2011Presentation class methodsFor: 'accessing'!
  417. title
  418. ^'Jtalk'
  419. ! !
  420. !ESUG2011Presentation class methodsFor: 'testing'!
  421. isConcrete
  422. ^true
  423. ! !
  424. Slide subclass: #IntroSlide
  425. instanceVariableNames: ''
  426. category: 'Presentation'!
  427. !IntroSlide methodsFor: 'accessing'!
  428. id
  429. ^'intro'
  430. !
  431. cssClass
  432. ^'slide black'
  433. ! !
  434. !IntroSlide methodsFor: 'rendering'!
  435. renderSlideOn: html
  436. html div class: 'section center'; with: [
  437. html h1 with: 'Jtalk, the Smalltalk for Web developers'.
  438. html p with: self presentation author, ' & Göran Krampe - ', self presentation description.
  439. html p with: [
  440. html a
  441. with: self presentation email;
  442. href: 'mailto:', self presentation email].
  443. html p with: [
  444. html a
  445. with: 'goran@krampe.se';
  446. href: 'mailto:goran@krampe.se'].
  447. html p with: [
  448. html a
  449. with: 'objectfusion.fr';
  450. href: 'http://www.objectfusion.fr']]
  451. ! !
  452. Slide subclass: #WhatIsJtalkSlide
  453. instanceVariableNames: ''
  454. category: 'Presentation'!
  455. !WhatIsJtalkSlide methodsFor: 'accessing'!
  456. id
  457. ^'WhatIsJtalk'
  458. ! !
  459. !WhatIsJtalkSlide methodsFor: 'rendering'!
  460. renderSlideOn: html
  461. html div class: 'section center'; with: [
  462. html h1 with: 'Jtalk in a nutshell'.
  463. html h2 with: 'Jtalk is an implementation of Smalltalk'.
  464. html h2 with: 'Jtalk runs on top of the JavaScript runtime'.
  465. html h2 with: 'Jtalk is an opensource project (MIT)'.
  466. html h2 class: 'fancy'; with: 'Jtalk is cool!!']
  467. ! !
  468. Slide subclass: #JtalkFeaturesSlide
  469. instanceVariableNames: ''
  470. category: 'Presentation'!
  471. !JtalkFeaturesSlide methodsFor: 'accessing'!
  472. id
  473. ^'features'
  474. ! !
  475. !JtalkFeaturesSlide methodsFor: 'rendering'!
  476. renderSlideOn: html
  477. html h1 with: 'Jtalk features'.
  478. html ul with: [
  479. html li with: 'Jtalk is (mostly) written in itself, including the parser & compiler'.
  480. html li with: 'Full Smalltalk object system, including classes & metaclasses, etc'.
  481. html li with: 'Core libraries (streams, collections, RegExp, etc)'.
  482. html li with: 'Web related libraries: HTML Canvas, DOM manipulation'.
  483. html li with: 'Full featured IDE'.
  484. html li with: [
  485. html with:'Advanced Smalltalk features, including '.
  486. html code with: '#doesNotUnderstand:'.
  487. html with: ' support and '.
  488. html code with: 'thisContext']]
  489. ! !
  490. Slide subclass: #AboutSlide
  491. instanceVariableNames: ''
  492. category: 'Presentation'!
  493. !AboutSlide methodsFor: 'accessing'!
  494. id
  495. ^'about'
  496. !
  497. cssClass
  498. ^'slide transparent white'
  499. !
  500. backgroundColor
  501. ^'white'
  502. ! !
  503. !AboutSlide methodsFor: 'rendering'!
  504. renderSlideOn: html
  505. html div class: 'section center'; with: [
  506. html h1 with: 'About this presentation'.
  507. html p with: 'This presentation is entirely written in Jtalk and is licensed under CC BY-SA.'.
  508. html p with: [
  509. html with: 'Press '.
  510. html code with: '←'.
  511. html with: ' to move backward and '.
  512. html code with: ' →'.
  513. html with: ' to move forward.'].
  514. html p with: [
  515. html with: 'Open a '.
  516. html button
  517. with: 'browser';
  518. onClick: [Browser openOn: Presentation].
  519. html with: ' to edit the source code.']]
  520. ! !
  521. Slide subclass: #JtalkAndJavascriptSlide3
  522. instanceVariableNames: ''
  523. category: 'Presentation'!
  524. !JtalkAndJavascriptSlide3 methodsFor: 'accessing'!
  525. id
  526. ^'jtalkAndJs3'
  527. !
  528. backgroundColor
  529. ^'#08C'
  530. ! !
  531. !JtalkAndJavascriptSlide3 methodsFor: 'rendering'!
  532. renderSlideOn: html
  533. html h1 with: [
  534. html with: 'Smalltalk '.
  535. html span class: 'red'; with: '♥'.
  536. html with: ' JavaScript'].
  537. html h2 with: 'Smalltalk ⇒ JavaScript'.
  538. html ol with: [
  539. html li
  540. with: 'Unary messages begin with an underscore: ';
  541. with: [html code with: 'yourself'];
  542. with: ' becomes ';
  543. with: [html code with: '_yourself()'].
  544. html li
  545. with: 'Binary messages are prefixed with 2 underscores: ';
  546. with: [html code with: '3@4'];
  547. with: ' becomes ';
  548. with: [html code with: '(3).__at(4)'].
  549. html li
  550. with: 'Keyword message follow the same rules as unary messages, with a final underscore: ';
  551. with: [html code with: 'aDictionary at: 3 put: 4'];
  552. with: ' becomes ';
  553. with: [html code with: 'aDictionary._at_put_(3, 4)']]
  554. ! !
  555. Slide subclass: #JtalkAndJavascriptSlide2
  556. instanceVariableNames: ''
  557. category: 'Presentation'!
  558. !JtalkAndJavascriptSlide2 methodsFor: 'accessing'!
  559. id
  560. ^'jtalkAndJs2'
  561. !
  562. backgroundColor
  563. ^'#08C'
  564. ! !
  565. !JtalkAndJavascriptSlide2 methodsFor: 'rendering'!
  566. renderSlideOn: html
  567. html h1 with: [
  568. html with: 'Smalltalk '.
  569. html span class: 'red'; with: '♥'.
  570. html with: ' JavaScript'].
  571. html h2 with: 'Jtalk maps one to one with the JavaScript equivalent:'.
  572. html ul with: [
  573. html li with: 'String ⇔ String'.
  574. html li with: 'Number ⇔ Number'.
  575. html li with: 'BlockClosure ⇔ function'.
  576. html li with: 'Dictionary ⇔ Object'.
  577. html li with: 'Error ⇔ Error'.
  578. html li with: 'etc.']
  579. ! !
  580. Slide subclass: #JtalkAndJavascriptSlide
  581. instanceVariableNames: ''
  582. category: 'Presentation'!
  583. !JtalkAndJavascriptSlide methodsFor: 'accessing'!
  584. id
  585. ^'jtalkAndJs'
  586. !
  587. cssClass
  588. ^'slide transparent'
  589. !
  590. backgroundColor
  591. ^'#08C'
  592. ! !
  593. !JtalkAndJavascriptSlide methodsFor: 'rendering'!
  594. renderSlideOn: html
  595. html div class: 'section center'; with: [
  596. html h1 with: [
  597. html with: 'Smalltalk '.
  598. html span class: 'red'; with: '♥'.
  599. html with: ' JavaScript']]
  600. ! !
  601. Slide subclass: #WorkspaceSlide
  602. instanceVariableNames: ''
  603. category: 'Presentation'!
  604. !WorkspaceSlide methodsFor: 'accessing'!
  605. id
  606. ^'workspace'
  607. !
  608. backgroundColor
  609. ^'#18bd7d'
  610. !
  611. renderSlideOn: html
  612. | workspace |
  613. workspace := SourceArea new.
  614. html div class: 'section center'; with: [
  615. html h1 with: 'Give Jtalk a try!!'.
  616. workspace renderOn: html.
  617. html div with: [
  618. html button
  619. with: 'DoIt';
  620. onClick: [workspace doIt].
  621. html button
  622. with: 'PrintIt';
  623. onClick: [workspace printIt].
  624. html button
  625. with: 'InspectIt';
  626. onClick: [workspace inspectIt]]]
  627. ! !
  628. Slide subclass: #CountersSlide
  629. instanceVariableNames: ''
  630. category: 'Presentation'!
  631. !CountersSlide methodsFor: 'accessing'!
  632. id
  633. ^'counters'
  634. !
  635. backgroundColor
  636. ^'#18bd7d'
  637. ! !
  638. !CountersSlide methodsFor: 'rendering'!
  639. renderSlideOn: html
  640. html div class: 'section center'; with: [
  641. html h1 with: 'The counter example'.
  642. html div with: [
  643. 2 timesRepeat: [Counter new renderOn: html]]]
  644. ! !
  645. Slide subclass: #JtalkAndJavascriptSlide4
  646. instanceVariableNames: ''
  647. category: 'Presentation'!
  648. !JtalkAndJavascriptSlide4 methodsFor: 'accessing'!
  649. id
  650. ^'jtalkAndJs4'
  651. !
  652. backgroundColor
  653. ^'#08C'
  654. ! !
  655. !JtalkAndJavascriptSlide4 methodsFor: 'rendering'!
  656. renderSlideOn: html
  657. html h1 with: [
  658. html with: 'JavaScript '.
  659. html span class: 'red'; with: '♥'.
  660. html with: ' Smalltalk too!! ';
  661. with: [html span class: 'comment'; with: '(how cute)']].
  662. html h2 with: 'JavaScript ⇒ Smalltalk'.
  663. html ol with: [
  664. html li
  665. with: [html code with: 'someUser.name'];
  666. with: ' becomes ';
  667. with: [html code with: 'someUser name'].
  668. html li
  669. with: [html code with: 'someUser name = "John"'];
  670. with: ' becomes ';
  671. with: [html code with: 'someUser name: ''John'''].
  672. html li
  673. with: [html code with: 'console.log(''hello world'')'];
  674. with: ' becomes ';
  675. with: [html code with: 'console log: ''hello world'''].
  676. html li
  677. with: [html code with: 'window.jQuery(''foo'').css(''background'', ''red'')'];
  678. with: ' becomes ';
  679. with: [html br];
  680. with: [html code with: '(window jQuery: ''foo'') css: ''background'' color: ''red''']]
  681. ! !
  682. Slide subclass: #IDESlide
  683. instanceVariableNames: ''
  684. category: 'Presentation'!
  685. !IDESlide methodsFor: 'accessing'!
  686. id
  687. ^'ide'
  688. !
  689. backgroundColor
  690. ^'black'
  691. !
  692. cssClass
  693. ^'slide transparent'
  694. ! !
  695. !IDESlide methodsFor: 'rendering'!
  696. renderSlideOn: html
  697. " html div class: 'section center'; with: [
  698. html h1
  699. with: 'The wonderful Jtalk ';
  700. with: [
  701. html a
  702. with: 'development tools';
  703. onClick: [TabManager current open]];
  704. with: '.']
  705. "
  706. ! !
  707. Slide subclass: #ContributionsSlide
  708. instanceVariableNames: ''
  709. category: 'Presentation'!
  710. !ContributionsSlide methodsFor: 'accessing'!
  711. id
  712. ^'links'
  713. ! !
  714. !ContributionsSlide methodsFor: 'rendering'!
  715. renderSlideOn: html
  716. html div class: 'section'; with: [
  717. html p with: [
  718. html a href: 'http://jtalk-project.org'; with: 'jtalk-project.org'].
  719. html p with: [
  720. html a href: 'https://github.com/NicolasPetton/jtalk'; with: 'github.com/NicolasPetton/jtalk'].
  721. html p with: [
  722. html a href: 'http://http://groups.google.com/group/jtalk-project'; with: 'groups.google.com/group/jtalk-project']]
  723. ! !
  724. Slide subclass: #JtalkAndCLI
  725. instanceVariableNames: ''
  726. category: 'Presentation'!
  727. !JtalkAndCLI methodsFor: 'not yet classified'!
  728. backgroundColor
  729. ^'#0A1'
  730. !
  731. id
  732. ^'JtalkAndCLI'
  733. !
  734. renderSlideOn: html
  735. html h1 with: [
  736. html with: 'Jtalk and '.
  737. html span class: 'blue'; with: 'the command line'].
  738. html h2 with: 'jtalkc - a fairly elaborate bash script that:'.
  739. html ul with: [
  740. html li with: 'Uses Node.js to run the Jtalk Compiler'.
  741. html li with: 'Compiles .st files to .js'.
  742. html li with: 'Links .js files into a single one'.
  743. html li with: 'Adds class initilization and/or call to main'.
  744. html li with: 'Optionally runs Google Closure compiler']
  745. ! !
  746. Slide subclass: #JtalkAndNode
  747. instanceVariableNames: ''
  748. category: 'Presentation'!
  749. !JtalkAndNode methodsFor: 'not yet classified'!
  750. backgroundColor
  751. ^'#0A1'
  752. !
  753. id
  754. ^'JtalkAndNode'
  755. !
  756. renderSlideOn: html
  757. html h1 with: [
  758. html with: 'Jtalk and '.
  759. html span class: 'blue'; with: 'Node.js'].
  760. html h2 with: 'Hello.st:'.
  761. html pre with: [
  762. html div class: 'code2'; with: 'Object subclass: #Hello
  763. instanceVariableNames: ''''
  764. category: ''Hello''!!
  765. !!Hello class methodsFor: ''main''!!
  766. main
  767. console log: ''Hello world from JTalk in Node.js''
  768. !! !!']
  769. ! !
  770. Slide subclass: #JtalkAndNode2
  771. instanceVariableNames: ''
  772. category: 'Presentation'!
  773. !JtalkAndNode2 methodsFor: 'not yet classified'!
  774. backgroundColor
  775. ^'#0A1'
  776. !
  777. id
  778. ^'JtalkAndNode2'
  779. !
  780. renderSlideOn: html
  781. html h1 with: [
  782. html with: 'Jtalk and '.
  783. html span class: 'blue'; with: 'Node.js'].
  784. html h2 with: 'Makefile:'.
  785. html pre with: [
  786. html div class: 'code2'; with: 'Program.js: Hello.st
  787. ../../bin/jtalkc -N -m Hello Hello.st Program
  788. run: Program.js
  789. ./hello
  790. clean:
  791. rm -f Program.js Hello.js
  792. '].
  793. html h2 with: 'hello:'.
  794. html pre with: [
  795. html div class: 'code2'; with: 'node Program.js $@']
  796. ! !
  797. Slide subclass: #JtalkAndNode3
  798. instanceVariableNames: ''
  799. category: 'Presentation'!
  800. !JtalkAndNode3 methodsFor: 'not yet classified'!
  801. backgroundColor
  802. ^'#0A1'
  803. !
  804. id
  805. ^'JtalkAndNode3'
  806. !
  807. renderSlideOn: html
  808. html h1 with: [
  809. html with: 'Jtalk and '.
  810. html span class: 'blue'; with: 'Node.js'].
  811. html h2 with: 'make clean && make run:'.
  812. html pre with: [
  813. html div class: 'code2'; with: 'rm -f Program.js Hello.js
  814. ../../bin/jtalkc -N -m Hello Hello.st Program
  815. Loading libraries /home/gokr/jtalk/js/boot.js /home/gokr/jtalk/js/Kernel.js
  816. /home/gokr/jtalk/js/Parser.js /home/gokr/jtalk/js/Compiler.js
  817. /home/gokr/jtalk/js/init.js /home/gokr/jtalk/nodejs/nodecompile.js
  818. and compiling ...
  819. Compiling in debugMode: false
  820. Reading file Hello.st
  821. Exporting category Hello as Hello.js
  822. Adding libraries /home/gokr/jtalk/js/boot.js /home/gokr/jtalk/js/Kernel.js ...
  823. Adding Jtalk code Hello.js ...
  824. Adding initializer /home/gokr/jtalk/js/init.js ...
  825. Adding call to Hello class >> main ...
  826. Writing Program.js ...
  827. Done.
  828. ./hello'.
  829. html span class: 'blue'; with:'Hello world from JTalk in Node.js']
  830. ! !
  831. Slide subclass: #JtalkAndWebOS
  832. instanceVariableNames: ''
  833. category: 'Presentation'!
  834. !JtalkAndWebOS methodsFor: 'not yet classified'!
  835. backgroundColor
  836. ^'#0A1'
  837. !
  838. id
  839. ^'JtalkAndWebOS'
  840. !
  841. renderSlideOn: html
  842. html h1 with: [
  843. html with: 'Jtalk and '.
  844. html span class: 'blue'; with: 'webOS'].
  845. html h2 with: 'A really cool mobile OS based on Linux:'.
  846. html ul with: [
  847. html li with: 'The primary language in webOS is Javascript'.
  848. html li with: 'The new UI framework for webOS 3.0 is called Enyo'.
  849. html li with: 'Regular apps run in V8 + Webkit'.
  850. html li with: 'Background services run in Node.js']
  851. ! !
  852. Slide subclass: #JtalkAndEnyo
  853. instanceVariableNames: ''
  854. category: 'Presentation'!
  855. !JtalkAndEnyo methodsFor: 'not yet classified'!
  856. id
  857. ^'JtalkAndEnyo'
  858. !
  859. backgroundColor
  860. ^'#0A1'
  861. !
  862. renderSlideOn: html
  863. html h1 with: [
  864. html with: 'Jtalk and '.
  865. html span class: 'blue'; with: 'Enyo'].
  866. ! !
  867. Widget subclass: #PresentationNavigator
  868. instanceVariableNames: 'presentationBrush currentPresentation'
  869. category: 'Presentation'!
  870. !PresentationNavigator methodsFor: 'accessing'!
  871. currentPresentation: aPresentation
  872. currentPresentation := aPresentation.
  873. !
  874. currentPresentation
  875. ^ currentPresentation ifNil: [currentPresentation := Presentation concretePresentations first new].
  876. !
  877. style
  878. ^ '
  879. #navigator {
  880. z-index: 1;
  881. position: fixed;
  882. top: 0;
  883. left: 50%;
  884. margin-left: -150px;
  885. padding: 5px;
  886. border-radius: 5px;
  887. -moz-border-radius: 5px;
  888. -webkit-border-radius: 5px;
  889. background: #333;
  890. opacity: 0.3;
  891. color: #eee;
  892. }
  893. #navigator a {
  894. font-weight: bold;
  895. color: #eee;
  896. text-decoration: none;
  897. cursor: pointer;
  898. padding: 0 2px;
  899. font-size: 14px;
  900. }
  901. #navigator:hover {
  902. opacity: 0.8;
  903. }
  904. '
  905. ! !
  906. !PresentationNavigator methodsFor: 'callbacks'!
  907. selectPresentation: aPresentationClass
  908. self currentPresentation: aPresentationClass new.
  909. self renderCurrentPresentation.
  910. !
  911. selectPresentationNamed: aString
  912. |presentationClass|
  913. presentationClass := (Smalltalk current at: aString).
  914. presentationClass ifNotNil: [ self selectPresentation: presentationClass ].
  915. !
  916. previousSlide
  917. self currentPresentation previousSlide
  918. !
  919. nextSlide
  920. self currentPresentation nextSlide
  921. !
  922. reload
  923. self currentPresentation: self currentPresentation class new.
  924. self renderCurrentPresentation.
  925. ! !
  926. !PresentationNavigator methodsFor: 'hash'!
  927. checkHash
  928. self currentPresentation checkHash
  929. !
  930. checkHashChange
  931. (window jQuery: window) bind: 'hashchange' do: [self checkHash]
  932. ! !
  933. !PresentationNavigator methodsFor: 'keybindings'!
  934. setKeybindings
  935. (window jQuery: document) keyup: [:e || node |
  936. node := e target nodeName asLowercase.
  937. (node = 'textarea' or: [node = 'input']) ifFalse: [
  938. e keyCode = 39 ifTrue: [self nextSlide].
  939. e keyCode = 37 ifTrue: [self previousSlide]]]
  940. ! !
  941. !PresentationNavigator methodsFor: 'rendering'!
  942. renderToolsOn: html
  943. html a
  944. with: 'IDE';
  945. onClick: [TabManager current open].
  946. html a
  947. with: 'Reload';
  948. onClick: [self reload].
  949. html a
  950. with: '←';
  951. onClick: [self previousSlide].
  952. html a
  953. with: '→';
  954. onClick: [self nextSlide].
  955. !
  956. renderPresentationSelectOn: html
  957. |presentationSelect|
  958. presentationSelect := html select.
  959. presentationSelect
  960. onChange: [self selectPresentationNamed: presentationSelect asJQuery val];
  961. with: [ Presentation concretePresentationsDo: [:aPresentationClass |
  962. html option
  963. value: aPresentationClass name;
  964. with: aPresentationClass title ] ].
  965. !
  966. open
  967. (window jQuery: document) ready: [
  968. self
  969. appendToJQuery: 'body' asJQuery;
  970. setKeybindings;
  971. checkHashChange.
  972. ].
  973. !
  974. renderOn: html
  975. html style
  976. type: 'text/css';
  977. with: self style.
  978. html div
  979. id: 'navigator';
  980. with: [ self
  981. renderToolsOn: html;
  982. renderPresentationSelectOn: html ].
  983. presentationBrush := html div
  984. id: 'presentation';
  985. yourself.
  986. self renderCurrentPresentation.
  987. !
  988. renderCurrentPresentation
  989. presentationBrush contents: [:html |
  990. self currentPresentation
  991. renderOn: html;
  992. checkHash.
  993. ].
  994. ! !
  995. !PresentationNavigator class methodsFor: 'initialize'!
  996. initialize
  997. ^ self open
  998. !
  999. open
  1000. ^ self new open
  1001. ! !