Presentation.st 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286
  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. Transcript show: anInteger.
  943. self currentPresentation moveAt: anInteger
  944. ! !
  945. !PresentationNavigator methodsFor: 'hash'!
  946. checkHash
  947. self currentPresentation checkHash
  948. !
  949. checkHashChange
  950. (window jQuery: window) bind: 'hashchange' do: [self checkHash]
  951. ! !
  952. !PresentationNavigator methodsFor: 'keybindings'!
  953. setKeybindings
  954. (window jQuery: document) keyup: [:e || node |
  955. node := e target nodeName asLowercase.
  956. (node = 'textarea' or: [node = 'input']) ifFalse: [
  957. e keyCode = 39 ifTrue: [self nextSlide].
  958. e keyCode = 37 ifTrue: [self previousSlide]]]
  959. ! !
  960. !PresentationNavigator methodsFor: 'rendering'!
  961. renderToolsOn: html
  962. html a
  963. with: 'IDE';
  964. onClick: [TabManager current open].
  965. html a
  966. with: 'Reload';
  967. onClick: [self reload].
  968. html a
  969. with: '←';
  970. onClick: [self previousSlide].
  971. html a
  972. with: '→';
  973. onClick: [self nextSlide].
  974. !
  975. renderPresentationSelectOn: html
  976. |presentationSelect|
  977. presentationSelect := html select.
  978. presentationSelect
  979. onChange: [self selectPresentationNamed: presentationSelect asJQuery val];
  980. with: [ Presentation concretePresentationsDo: [:aPresentationClass |
  981. html option
  982. value: aPresentationClass name;
  983. with: aPresentationClass title ] ].
  984. !
  985. open
  986. (window jQuery: document) ready: [
  987. self
  988. appendToJQuery: 'body' asJQuery;
  989. setKeybindings;
  990. checkHashChange.
  991. ].
  992. !
  993. renderOn: html
  994. html style
  995. type: 'text/css';
  996. with: self style.
  997. html div
  998. id: 'navigator';
  999. with: [ self
  1000. renderToolsOn: html;
  1001. renderPresentationSelectOn: html;
  1002. renderSlideSelectOn: html].
  1003. presentationBrush := html div
  1004. id: 'presentation';
  1005. yourself.
  1006. self renderCurrentPresentation.
  1007. !
  1008. renderCurrentPresentation
  1009. presentationBrush contents: [:html |
  1010. self currentPresentation
  1011. renderOn: html;
  1012. checkHash.
  1013. ].
  1014. !
  1015. renderSlideSelectOn: html
  1016. slideSelect := html select.
  1017. slideSelect onChange: [ self selectSlideAt: slideSelect asJQuery val ].
  1018. self updateSlideSelect.
  1019. !
  1020. updateSlideSelect
  1021. slideSelect contents: [:html| |index|
  1022. index := 0.
  1023. self currentPresentation slidesDo: [ :aSlide|
  1024. index := index + 1.
  1025. html option
  1026. value: index;
  1027. with: aSlide title ] ].
  1028. ! !
  1029. !PresentationNavigator class methodsFor: 'initialize'!
  1030. initialize
  1031. ^ self open
  1032. !
  1033. open
  1034. ^ self new open
  1035. ! !