diff --git a/client/scripts.html b/client/scripts.html index 2b69145..05422d6 100644 --- a/client/scripts.html +++ b/client/scripts.html @@ -30,17 +30,44 @@ var more = document.createElement("a"); more.textContent = " show more"; more.style.cursor = "pointer"; + more.classList.add("link-show-more") + more.onclick = function () { - element.style.display = display; - newElement.style.display = "none"; + var short= this.parentNode; + var sibling= short.parentNode.firstChild; + var long; + while (sibling) { + if(sibling.classList && sibling.classList.contains('long-version')){ + long=sibling; + break; + } + sibling = sibling.nextSibling; + + } + + long.style.display = display; + short.style.display = "none"; }; var less = document.createElement("a"); less.textContent = " show less"; less.style.cursor = "pointer"; + less.classList.add("link-show-less") less.onclick = function () { - element.style.display = "none"; - newElement.style.display = display; + var long= this.parentNode; + var sibling= long.parentNode.firstChild; + var short; + while (sibling) { + if(sibling.classList && sibling.classList.contains('short-version')){ + short=sibling; + break; + } + sibling = sibling.nextSibling; + + } + + short.style.display = display; + long.style.display = "none"; }; newElement.appendChild(more); diff --git a/model/opmlModels.go b/model/opmlModels.go index ca78462..4ea08c7 100644 --- a/model/opmlModels.go +++ b/model/opmlModels.go @@ -12,8 +12,20 @@ type OpmlModel struct { Head OpmlHead `xml:"head"` Body OpmlBody `xml:"body"` } +type OpmlExportModel struct { + XMLName xml.Name `xml:"opml"` + Text string `xml:",chardata"` + Version string `xml:"version,attr"` + Head OpmlExportHead `xml:"head"` + Body OpmlBody `xml:"body"` +} type OpmlHead struct { + Text string `xml:",chardata"` + Title string `xml:"title"` + //DateCreated time.Time `xml:"dateCreated"` +} +type OpmlExportHead struct { Text string `xml:",chardata"` Title string `xml:"title"` DateCreated time.Time `xml:"dateCreated"` diff --git a/service/podcastService.go b/service/podcastService.go index 5cefb14..d1e5f26 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -85,6 +85,7 @@ func GetAllPodcasts(sorting string) *[]db.Podcast { func AddOpml(content string) error { model, err := ParseOpml(content) if err != nil { + fmt.Println(err.Error()) return errors.New("Invalid file format") } var wg sync.WaitGroup @@ -127,8 +128,8 @@ func ExportOmpl() ([]byte, error) { outlines = append(outlines, toAdd) } - toExport := model.OpmlModel{ - Head: model.OpmlHead{ + toExport := model.OpmlExportModel{ + Head: model.OpmlExportHead{ Title: "Podgrab Feed Export", DateCreated: time.Now(), },