Himalayan-Academy / Siva-Siva-App

Code Repository for the Siva Siva Mobile App
11 stars 3 forks source link

Bookmark Pages #310

Closed Brahmanathaswami closed 3 years ago

Brahmanathaswami commented 3 years ago

parseTheHTML

It will to found in

libraries/lib_SivaSivaBookmark

it is called by the browers:

modified:   views/behavior_view_SivaSivaBrowser.livecodescript

line 208 to 214 which is commented out

And what is wanted to journal_AddEntry

so that they can get back, not read the book from the beginning

command parseTheHTML pHtmlText, pTargetString
   # use for scraping out anything from the htmltext of a browser widget
   # must call *after* URL loads
   switch pTargetString
      case "Title"
         put (offset ("<Title>", pHTMLText) +7) into tStartTitle
         put (offset ("</Title>", pHTMLText) -1) into tEndTitle
         put  (char tStartTitle to tEndTitle of pHTMLText) into tRawTitle
         replace cr with "" in tRawTitle
         replace tab with "" in tRawTitle
         # we are inconsistent in the title delimiter passed in our CMS
         # sometime the leading "realm" is separated by a colon, other time a dash
         replace ": " with "-" in tRawTitle # normalize all those...
         set the itemdel to "-" # set up for two part titles
         if tRawTitle contains "YouTube" then # leave it alone
            put "YouTube" into sLastWebPageTitle  # upgrade this later... 
         else # from our web site
            if browser_GetLastURL() contains "/book/" then
               # pass just the first words
               put word 1 to 5 of tRawTitle into tRawTitle
            else
               # not a book page...
               if the number of items of tRawTitle = 2 then
                  put item 2 of tRawTitle into tRawtitle
               end if
               If char 1 of tRawTitle = " " then 
                  delete char 1 of tRawTitle
               end if   
            end if

         end if
         put tRawTitle into sLastWebPageTitle
         break
   end switch
end parseTheHTML

on journal_AddEntry

   local pData, tTitle, tOutput,tHardToParsePages

   # this is a hack  until we figure out the regEx for matchText 
   # for the <title class="whatever"....> in find in Gatsby and other pages
   # we get the title from the original mouseup of the portal screen

   put "Pillars of Iraivan" into tHardToParsePages

   if sBrowserURL contains "YouTube" then
      # the journal label is taken from the JSON of out navigation dictionary
      # which are appears on this sub nav list.
      # for now, this implemention of Video is contrain to that list
      # leave it for now
      put portal_GetLabel() into tTitle
   else
      # we have some web page, probably in portrait mode
      # it could be HAP page form the /html folder, or a revOIgniter built media page, 
      # or a internal page of some books that Andre build from exploded ePub/Zip
      # the challenge is to get a proper label, especially from the books.
      put getJournalData() into tTitle

      --      if tTitle is not among the items of tHardToParsePages then
      --         put parseTheHTML(sHTMLtext,"bookmark") into tTitle
      --      end if

      --put titleFromURL(browser_GetLastURL())  into tTitle
      --put parseTheHTML(the htmltext of widget "body","bookmark") into tTitle
      --put titleFromURL(browser_GetLastURL())  into tTitle

   end if

   put browser_GetLastURL() into pData["url"] 

   if sLandscapeOnly then

      Journal_RecordEntry "view_BrowserLandscape",tTitle,pData  
   else
      Journal_RecordEntry "view_SivaSivaBrowser",tTitle,pData   
   end if
   --dialog_CustomMsg "Saved to Journal"
end journal_AddEntry
soapdog commented 3 years ago

This is about making sure the journalResume on a book goes back to the same vscroll position on the book.

Brahmanathaswami commented 3 years ago

It does not work! It works on desktop, BUT in Simulator!

on Desktop we get a view that won't scroll

2021-07-06_16-30-59

but on Simulator we DO GET scroll? But at the beginning the over the book!

Brahmanathaswami commented 3 years ago

https://user-images.githubusercontent.com/3675722/124692454-57c6fd80-de79-11eb-9179-98aeeeb1a707.mp4