'From Squeak5.2alpha of 30 June 2018 [latest update: #18121] on 2 July 2018 at 7:22:08 am'! ScrollableField subclass: #HTMLScrollableField instanceVariableNames: 'visitedUrls page' classVariableNames: '' poolDictionaries: '' category: 'SqueakRos'! !HTMLScrollableField commentStamp: 'edc 6/29/2018 09:33' prior: 0! HTMLScrollableField swiki HTMLScrollableField default HTMLScrollableField default renderMe: '310 ENH from Mantis' ! HTMLScrollableField class instanceVariableNames: 'current'! !DictionaryInspector methodsFor: 'menu' stamp: 'edc 8/11/2010 06:12'! findPartialKey | newKey nD | newKey := UIManager default request: 'Enter new key, then type RETURN'. nD := Dictionary new. object associationsDo: [:mAssoc | (mAssoc key includesSubstring: newKey caseSensitive: false) ifTrue: [nD add: mAssoc]]. ^ nD inspect! ! !DictionaryInspector methodsFor: 'menu' stamp: 'edc 6/29/2018 10:01'! mainFieldListMenu: aMenu ^ aMenu addList: #( ('inspect' inspectSelection) ('inspect key' inspectKey) ('copy name' copyName) ('references' selectionReferences) ('objects pointing to this value' objectReferencesToSelection) ('senders of this key' sendersOfSelectedKey) ('find partial key' findPartialKey) - ('refresh view' refreshView) ('add key' addEntry) ('rename key' renameEntry) - ('remove' removeSelection) ('basic inspect' inspectBasic)); yourself ! ! !HTMLScrollableField methodsFor: 'accessing' stamp: 'edc 6/29/2018 09:22'! page ^ page! ! !HTMLScrollableField methodsFor: 'accessing' stamp: 'edc 6/29/2018 09:22'! page: anObject page := anObject.! ! !HTMLScrollableField methodsFor: 'accessing' stamp: 'edc 12/29/2005 11:56'! visitedUrls "Answer the value of visitedUrls" ^ visitedUrls! ! !HTMLScrollableField methodsFor: 'accessing' stamp: 'edc 12/29/2005 11:56'! visitedUrls: anObject "Set the value of visitedUrls" visitedUrls _ anObject! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:42'! footer ^ ' '! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:37'! head ^ ' ' ! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 5/12/2006 12:05'! jumpToUrl: url | stream aText | stream := (HTTPSocket httpGet: url accept: 'application/octet-stream') contents. aText := (HtmlParser parse: stream) formattedText. self setMyText: aText. self visitedUrls add: url. ! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:34'! pageAdd: aString page:= self page,aString! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:40'! pageContent: aMiHTMLData | mes | mes := aMiHTMLData date asMonth asString. mes := mes truncateTo: 3. ^ '
' + aMiHTMLData body + '
'! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:47'! pageEnd | aText | self pageAdd: ' '. aText := (HtmlParser parse: self page) formattedText. self setMyText: aText. self openInWorld. self visitedUrls add: page ! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:20'! renderMe: aString | pages | pages := DivagacionesIndex default at: aString ifAbsent: []. pages ifNotNil: [Divagaciones currentPage: pages first. ^ self thisPost: pages first view: pages first css]. ^ 'Page named: ' , aString , ' do not exist'! ! !HTMLScrollableField methodsFor: 'as yet unclassified' stamp: 'edc 6/29/2018 09:37'! thisPost: aMiHTMLData view: aView self page: self head. self pageAdd: '
'. self pageAdd: (self pageContent: aMiHTMLData). self pageAdd: '
'. self pageAdd: self footer. ^ self pageEnd! ! !HTMLScrollableField class methodsFor: 'as yet unclassified' stamp: 'edc 6/26/2018 06:02'! current ^current! ! !HTMLScrollableField class methodsFor: 'as yet unclassified' stamp: 'edc 6/26/2018 06:02'! current: anUrl current:= anUrl! ! !HTMLScrollableField class methodsFor: 'as yet unclassified' stamp: 'edc 6/26/2018 05:45'! default | newInstance r | newInstance := self newStandAlone. newInstance color: (Color r: 0.972 g: 0.972 b: 0.662). r := Rectangle left: World left + 50 right: World right - 50 top: World top + 100 bottom: World bottom - 50. newInstance bounds: r. newInstance visitedUrls: OrderedCollection new. ^newInstance openInWorld! ! !HTMLScrollableField class methodsFor: 'as yet unclassified' stamp: 'edc 6/26/2018 06:17'! swiki "HTMLScrollableField swiki" | stream aText sf | stream := HTTPSocket httpGet: 'http://wiki.squeak.org/squeak'. aText := (HtmlParser parse: stream) formattedText. sf := HTMLScrollableField default. sf setMyText: aText. sf visitedUrls add: 'http://wiki.squeak.org/squeak/'. self current: sf. ^ sf openInWorld! ! !HTMLScrollableField class methodsFor: 'as yet unclassified' stamp: 'edc 4/5/2006 09:04'! url: url | stream aText sf | stream := (HTTPSocket httpGet: url accept: 'application/octet-stream') contents. aText := (HtmlParser parse: stream) formattedText. sf := HTMLScrollableField default. sf setMyText: aText. sf visitedUrls add: 'http://www.newsoftheodd.com/'. ^sf openInWorld! ! !TextURL methodsFor: '*Morphic' stamp: 'edc 6/26/2018 06:23'! actOnClickFor: anObject "Do what you can with this URL. Later a web browser." | response m swikiPage| (url beginsWith: 'sqPr://') ifTrue: [ ProjectLoading thumbnailFromUrl: (url copyFrom: 8 to: url size). ^self "should not get here, but what the heck" ]. "if it's a web browser, tell it to jump" anObject isWebBrowser ifTrue: [anObject jumpToUrl: url. ^ true] ifFalse: [((anObject respondsTo: #model) and: [anObject model isWebBrowser]) ifTrue: [anObject model jumpToUrl: url. ^ true]]. "if it's a morph, see if it is contained in a web browser" (Smalltalk classNamed: #HTMLScrollableField) ifNotNil:[swikiPage := ( url findTokens: '/') last. HTMLScrollableField current jumpToUrl:(HTMLScrollableField current visitedUrls first, swikiPage ). ^true. ]. (anObject isKindOf: Morph) ifTrue: [ m := anObject. [ m ~= nil ] whileTrue: [ (m isWebBrowser) ifTrue: [ m jumpToUrl: url. ^true ]. (m hasProperty: #webBrowserView) ifTrue: [ m model jumpToUrl: url. ^true ]. m := m owner. ] ]. "no browser in sight. ask if we should start a new browser" ((self confirm: 'open a browser to view this URL?' translated) and: [WebBrowser default notNil]) ifTrue: [ WebBrowser default openOnUrl: url. ^ true ]. "couldn't display in a browser. Offer to put up just the source" response := (UIManager default chooseFrom: (Array with: 'View web page as source' translated with: 'Cancel' translated) title: 'Couldn''t find a web browser. View\page as source?' withCRs translated). response = 1 ifTrue: [HTTPSocket httpShowPage: url]. ^ true! ! HTMLScrollableField class removeSelector: #bbcNews! HTMLScrollableField class removeSelector: #isla! HTMLScrollableField class removeSelector: #redes!