Presentation.st 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  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. self selectPresentation: (Smalltalk current at: aString)
  913. !
  914. previousSlide
  915. self currentPresentation previousSlide
  916. !
  917. nextSlide
  918. self currentPresentation nextSlide
  919. !
  920. reload
  921. self currentPresentation: self currentPresentation class new.
  922. self renderCurrentPresentation.
  923. ! !
  924. !PresentationNavigator methodsFor: 'hash'!
  925. checkHash
  926. self currentPresentation checkHash
  927. !
  928. checkHashChange
  929. (window jQuery: window) bind: 'hashchange' do: [self checkHash]
  930. ! !
  931. !PresentationNavigator methodsFor: 'keybindings'!
  932. setKeybindings
  933. (window jQuery: document) keyup: [:e || node |
  934. node := e target nodeName asLowercase.
  935. (node = 'textarea' or: [node = 'input']) ifFalse: [
  936. e keyCode = 39 ifTrue: [self nextSlide].
  937. e keyCode = 37 ifTrue: [self previousSlide]]]
  938. ! !
  939. !PresentationNavigator methodsFor: 'rendering'!
  940. renderToolsOn: html
  941. html a
  942. with: 'IDE';
  943. onClick: [TabManager current open].
  944. html a
  945. with: 'Reload';
  946. onClick: [self reload].
  947. html a
  948. with: '←';
  949. onClick: [self previousSlide].
  950. html a
  951. with: '→';
  952. onClick: [self nextSlide].
  953. !
  954. renderPresentationSelectOn: html
  955. html select
  956. onChange: [:anEvent | self selectPresentationNamed: anEvent target value];
  957. with: [ Presentation concretePresentationsDo: [:aPresentationClass |
  958. html option
  959. value: aPresentationClass name;
  960. with: aPresentationClass title ] ].
  961. !
  962. open
  963. (window jQuery: document) ready: [
  964. self
  965. appendToJQuery: 'body' asJQuery;
  966. setKeybindings;
  967. checkHashChange.
  968. ].
  969. !
  970. renderOn: html
  971. html style
  972. type: 'text/css';
  973. with: self style.
  974. html div
  975. id: 'navigator';
  976. with: [ self
  977. renderToolsOn: html;
  978. renderPresentationSelectOn: html ].
  979. presentationBrush := html div
  980. id: 'presentation';
  981. yourself.
  982. self renderCurrentPresentation.
  983. !
  984. renderCurrentPresentation
  985. presentationBrush contents: [:html |
  986. self currentPresentation
  987. renderOn: html;
  988. checkHash.
  989. ].
  990. ! !
  991. !PresentationNavigator class methodsFor: 'initialize'!
  992. initialize
  993. ^ self open
  994. !
  995. open
  996. ^ self new open
  997. ! !