2
0

Presentation.st 25 KB

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