'========================================================================
'Projekt: Frontpage-Erweiterungen
'Modul: ojMetatagsBearbeitenForm
'Version: 1.1
'Frontpage: 2000
'Nutzung: Freeware
'Copyright: (c) 2001 by Otto Janko. All Rights Reserved.
'Version: 1.101
'Veränderungen gegenüber 1.1
' am Ende jeden Metatags vbCRLF eingefügt, Code ist besser lesbar
' separates Einlesen jeden Metatags
Option Explicit
Private Sub
CmdEinlesAlles_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If
Dim
myDoc As Object
Set
myDoc = Seite.ActiveDocument.all
If
myDoc.tags("title").Length = 0 Then
Title = ""
Else
Title = myDoc.tags("title")(0).innerText
End If
If
myDoc.tags("meta").Item("author") Is Nothing Then
Author = ""
Else
Author = myDoc.tags("meta").Item("author").getAttribute("content")
End If
If
myDoc.tags("meta").Item("publisher") Is Nothing Then
Publisher = ""
Else
Publisher = myDoc.tags("meta").Item("publisher").getAttribute("content")
End If
If
myDoc.tags("meta").Item("copyright") Is Nothing Then
Copyright = ""
Else
Copyright = myDoc.tags("meta").Item("copyright").getAttribute("content")
End If
If
myDoc.tags("meta").Item("description") Is Nothing Then
Description = ""
Else
Description = myDoc.tags("meta").Item("description").getAttribute("content")
End If
If
myDoc.tags("meta").Item("keywords") Is Nothing Then
Keywords = ""
Else
Keywords = myDoc.tags("meta").Item("keywords").getAttribute("content")
End If
If
myDoc.tags("meta").Item("robots") Is Nothing Then
Robots = ""
Else
Robots = myDoc.tags("meta").Item("robots").getAttribute("content")
End If
If
myDoc.tags("meta").Item("revisit-after") Is Nothing Then
Revisit = ""
Else
Revisit = myDoc.tags("meta").Item("revisit-after").getAttribute("content")
End If
ContentType = ""
ContentLanguage = ""
Expires = ""
Pragma = ""
Refresh = ""
Dim
Item As Variant
For Each
Item In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "content-type" Then
ContentType = Item.getAttribute("content")
End If
If
LCase(Item.httpEquiv) = "content-language" Then
ContentLanguage = Item.getAttribute("content")
End If
If
LCase(Item.httpEquiv) = "expires" Then
Expires = Item.getAttribute("content")
End If
If
LCase(Item.httpEquiv) = "pragma" Then
Pragma = Item.getAttribute("content")
End If
If
LCase(Item.httpEquiv) = "refresh" Then
Refresh = Item.getAttribute("content")
End If
Next
Item
End Sub
Private Sub
CmdEinlesAutor_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("author") Is
Nothing Then
Author = ""
Else
Author = myDoc.tags("meta").Item("author").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesBeschreibung_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("description") Is
Nothing Then
Description = ""
Else
Description = myDoc.tags("meta").Item("description").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesContentLanguage_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "content-language"
Then
ContentLanguage = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
CmdEinlesContenttype_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "content-type"
Then
ContentType = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
CmdEinlesCopy_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("copyright") Is
Nothing Then
Copyright = ""
Else
Copyright = myDoc.tags("meta").Item("copyright").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesExpires_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "expires" Then
Expires = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
CmdEinlesPragma_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "pragma" Then
Pragma = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
CmdEinlesRefresh_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "refresh" Then
Refresh = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
CmdEinlesRevisit_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("revisit-after")
Is Nothing Then
Revisit = ""
Else
Revisit = myDoc.tags("meta").Item("revisit-after").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesRobots_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("robots") Is
Nothing Then
Robots = ""
Else
Robots = myDoc.tags("meta").Item("robots").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesSchluessel_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("meta").Item("keywords") Is
Nothing Then
Keywords = ""
Else
Keywords = myDoc.tags("meta").Item("keywords").getAttribute("content")
End If End Sub
Private Sub
CmdEinlesTitel_Click()
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("title").Length = 0 Then
Title = ""
Else
Title = myDoc.tags("title")(0).innerText
End If End Sub
Private Sub
CmdUebAutor_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If If Not
myDoc.tags("meta").Item("author")
Is Nothing Then
myDoc.tags("meta").Item("author").outerHTML = "" & vbCrLf
End If If
Author <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<meta
name=""author"" content=""" & Author & """>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
CmdUebCopy_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If If Not
myDoc.tags("meta").Item("copyright")
Is Nothing Then
myDoc.tags("meta").Item("copyright").outerHTML = "" & vbCrLf
End If If
Copyright <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<meta
name=""copyright"" content=""" & Copyright & """>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
CmdUebPublisher_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
k As Object If Not
myDoc.tags("meta").Item("publisher") Is Nothing Then
myDoc.tags("meta").Item("publisher").outerHTML = "" & vbCrLf
End If If
Publisher <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<meta name=""publisher""
content=""" & Publisher & """>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
CmdUebRevisit_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If If Not
myDoc.tags("meta").Item("revisit-after")
Is Nothing Then
myDoc.tags("meta").Item("revisit-after").outerHTML = "" & vbCrLf
End If If
Revisit <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<meta name=""revisit-after""
content=""" & Revisit & """>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
CmdUebRobots_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If If Not
myDoc.tags("meta").Item("robots")
Is Nothing Then
myDoc.tags("meta").Item("robots").outerHTML = ""
End If If
Robots <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<meta name=""robots""
content=""" & Robots & """>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
CmdUebTitel_Click()
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If If
myDoc.tags("title").Length <> 0
Then
myDoc.tags("title")(0).outerHTML = ""
End If If
Title <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<title>" & Title &
"</title>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub
Private Sub
UserForm_Initialize()
'* META-Tags aus der aktuellen Seite in den Dialog übernehmen
Dim
Seite As
PageWindow
Set
Seite = ActivePageWindow
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
If
myDoc.tags("title").Length = 0 Then
Title = ""
Else
Title = myDoc.tags("title")(0).innerText
End If If
myDoc.tags("meta").Item("author")
Is Nothing Then
Author = ""
Else
Author = myDoc.tags("meta").Item("author").getAttribute("content")
End If If
myDoc.tags("meta").Item("publisher")
Is Nothing Then
Publisher = ""
Else
Publisher = myDoc.tags("meta").Item("publisher").getAttribute("content")
End If If
myDoc.tags("meta").Item("copyright")
Is Nothing Then
Copyright = ""
Else
Copyright = myDoc.tags("meta").Item("copyright").getAttribute("content")
End If If
myDoc.tags("meta").Item("description")
Is Nothing Then
Description = ""
Else
Description = myDoc.tags("meta").Item("description").getAttribute("content")
End If If
myDoc.tags("meta").Item("keywords")
Is Nothing Then
Keywords = ""
Else
Keywords = myDoc.tags("meta").Item("keywords").getAttribute("content")
End If If
myDoc.tags("meta").Item("robots")
Is Nothing Then
Robots = ""
Else
Robots = myDoc.tags("meta").Item("robots").getAttribute("content")
End If If
myDoc.tags("meta").Item("revisit-after")
Is Nothing Then
Revisit = ""
Else
Revisit = myDoc.tags("meta").Item("revisit-after").getAttribute("content")
End If
ContentType = "" ContentLanguage = "" Expires = "" Pragma = "" Refresh = ""
Dim
Item As Variant For Each
Item
In
myDoc.tags("meta")
If
LCase(Item.httpEquiv) = "content-type"
Then
ContentType = Item.getAttribute("content")
End If If
LCase(Item.httpEquiv) = "content-language"
Then
ContentLanguage = Item.getAttribute("content")
End If If
LCase(Item.httpEquiv) = "expires"
Then
Expires = Item.getAttribute("content")
End If If
LCase(Item.httpEquiv) = "pragma"
Then
Pragma = Item.getAttribute("content")
End If If
LCase(Item.httpEquiv) = "refresh"
Then
Refresh = Item.getAttribute("content")
End If Next
Item
End Sub
Private Sub
ApplyButton_Click() Uebernehmen
End Sub
Private Sub
CancelButton_Click() Unload Me
End Sub
Private Sub
OkButton_Click() Uebernehmen Unload Me
End Sub
Private Sub
Uebernehmen()
'* META-Tags aus dem Dialog in die aktuellen Seite übernehmen
'* Zuerst TITLE, dann META NAME="", dann META HTTP-EQUIV=""
'* Die Tags werden in umgekehrter Reihenfolge eingefügt
Dim
Seite As
PageWindow, OldMode
As Integer Set
Seite = ActivePageWindow OldMode = Seite.ViewMode
If
CbNormal = True Then
Seite.ViewMode = fpPageViewNormal
End If Dim
myDoc As Object Set
myDoc =
Seite.ActiveDocument.all
Dim
k As Object Dim
i As
Integer If
Seite.ViewMode <> fpPageViewNormal Then
Seite.ViewMode = fpPageViewNormal
End If For
i = myDoc.tags("meta").Length - 1
To
0 Step
-1
Set
k = myDoc.tags("meta").Item(i)
If
(LCase(k.httpEquiv) = "content-type") Or
(LCase(k.httpEquiv) = _ "content-language") Or
(LCase(k.httpEquiv)
= "expires") Or
_ (LCase(k.httpEquiv) = "pragma")
Or
(LCase(k.httpEquiv) = "refresh") Then
k.outerHTML = ""
End If Next
i
If
Refresh <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta http-equiv=""refresh""
content=""" & Refresh & """>" & vbCrLf
End If If
Pragma <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta http-equiv=""pragma""
content=""" & Pragma & """>" & vbCrLf
End If If
Expires <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta http-equiv=""expires""
content=""" & Expires & """>" & vbCrLf
End If If
ContentLanguage <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta http-equiv=""content-language""
content=""" & ContentLanguage & _ """>" & vbCrLf
End If If
ContentType <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta http-equiv=""content-type""
content=""" & ContentType & """>" & _ vbCrLf
End If If Not
myDoc.tags("meta").Item("revisit-after")
Is Nothing Then
myDoc.tags("meta").Item("revisit-after").outerHTML = "" & vbCrLf
End If If
Revisit <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""revisit-after""
content=""" & Revisit & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("robots")
Is Nothing Then
myDoc.tags("meta").Item("robots").outerHTML = ""
End If If
Robots <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""robots""
content=""" & Robots & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("keywords")
Is Nothing Then
myDoc.tags("meta").Item("keywords").outerHTML = "" & vbCrLf
End If If
Keywords <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""keywords""
content=""" & Keywords & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("description")
Is Nothing Then
myDoc.tags("meta").Item("description").outerHTML = "" & vbCrLf
End If If
Description <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""description""
content=""" & Description & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("publisher")
Is Nothing Then
myDoc.tags("meta").Item("publisher").outerHTML = "" & vbCrLf
End If If
Publisher <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""publisher""
content=""" & Publisher & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("copyright")
Is Nothing Then
myDoc.tags("meta").Item("copyright").outerHTML = "" & vbCrLf
End If If
Copyright <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""copyright""
content=""" & Copyright & """>" & vbCrLf
End If If Not
myDoc.tags("meta").Item("author")
Is Nothing Then
myDoc.tags("meta").Item("author").outerHTML = "" & vbCrLf
End If If
Author <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", _ "<meta name=""author""
content=""" & Author & """>" & vbCrLf
End If If
myDoc.tags("title").Length <> 0
Then
myDoc.tags("title")(0).outerHTML = ""
End If If
Title <> "" Then
myDoc.tags("head")(0).insertAdjacentHTML "AfterBegin", "<title>" & Title & _
"</title>" & vbCrLf
End If
Seite.ViewMode = OldMode
End Sub