61 lines
1.2 KiB
Smalltalk
61 lines
1.2 KiB
Smalltalk
"
|
|
I manage instagram URLs information.
|
|
|
|
InstagramUrl newURL: 'https://instagram.com/restOfURL'
|
|
"
|
|
Class {
|
|
#name : #InstagramUrl,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'url'
|
|
],
|
|
#category : #Instagram
|
|
}
|
|
|
|
{ #category : #'instance creation' }
|
|
InstagramUrl class >> newURL: url [
|
|
| instance urlCheck |
|
|
instance := self new.
|
|
(url includesSubstring: 'instagram.com')
|
|
ifFalse: [ UIManager default inform: '" ', url, ' " it''s not an instagram URL.'.
|
|
^ self new ].
|
|
urlCheck := url asUrl.
|
|
urlCheck hasHost ifFalse: [ urlCheck host: urlCheck segments first.
|
|
urlCheck removeFirstPathSegment. ].
|
|
urlCheck hasScheme ifFalse: [ urlCheck scheme: 'https' ].
|
|
instance url: urlCheck .
|
|
^ instance
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
InstagramUrl >> initialize [
|
|
| initial |
|
|
initial := 'https://www.instagram.com' asUrl.
|
|
super initialize.
|
|
self url: initial.
|
|
|
|
|
|
]
|
|
|
|
{ #category : #opening }
|
|
InstagramUrl >> openWithoutTracking [
|
|
WebBrowser openOn: self urlWithoutTracking
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
InstagramUrl >> url [
|
|
|
|
^ url
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
InstagramUrl >> url: aURL [
|
|
|
|
url := aURL
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
InstagramUrl >> urlWithoutTracking [
|
|
^ self url queryRemoveAll; asStringOrText
|
|
]
|