33document . addEventListener (
44 "DOMContentLoaded" ,
55 function ( ) {
6- window . addEventListener ( "load" , onclick , false ) ;
7-
8- function doThing ( res ) {
9-
10-
11-
12-
13- var s = document . createElement ( 'script' ) ;
14- s . setAttribute ( 'src' , 'jquery-3.6.0.min.js' ) ;
15- document . body . appendChild ( s ) ;
16-
17- var g = document . createElement ( 'script' ) ;
18- g . setAttribute ( 'src' , 'handlebars-v4.7.7.js' ) ;
19- document . body . appendChild ( g ) ;
20-
21-
22- //Retrieve the template data from the HTML .
23-
6+ window . addEventListener ( "load" , onload , false ) ;
247
8+ function setCount ( res ) {
259
2610 var taxonomy = res . verse . taxonomy ;
2711 var book = res . verse . book
@@ -34,53 +18,83 @@ document.addEventListener(
3418 var sermon_church = res . video . sermon_url
3519 var sermon_location = res . verse . sermon_location
3620
37-
3821 //alert(taxonomy)
3922
4023 linebreak = document . createElement ( "br" ) ;
4124 paragraph = document . createElement ( "br" ) ;
4225
43- const div = document . createElement ( "div" ) ;
44-
45-
46- document . body . appendChild ( div ) ;
47-
48- div . textContent = "What does the bible say about " + taxonomy ;
49-
50-
51-
52- document . body . append ( book + " " + chapter + " : " + verse , paragraph ) ;
53-
26+ const div1 = document . createElement ( "div" ) ;
27+ document . body . appendChild ( div1 ) ;
28+ div1 . textContent = "What does the Bible say about " + taxonomy . toLowerCase ( ) + "?" ;
29+ div1 . style . fontWeight = "bold" ;
30+ div1 . style . marginBottom = "10px" ;
31+ //document.body.append(book + " " + chapter + ":" + verse, paragraph);
32+ document . body . append ( book + " " + chapter + ":" + verse ) ;
33+ document . body . append ( " says in Scripture:" ) ;
5434 document . body . append ( linebreak ) ;
55-
56-
57- document . body . append ( verse ) ;
58- document . body . append ( linebreak ) ;
59-
60- // const video = document.createElement("<iframe title='YouTube video player' type=\"text/html\" width='640' height='390' src='${sermon_url}' frameborder='0' allowFullScreen></iframe>")
61-
62-
63- // document.body.append(video);
6435
65-
66-
67-
68- var obj = { "video" : {
69- "value" : `<iframe title='YouTube video player' type=\"text/html\" width='640' height='390' src=https://www.youtube.com/embed/${ sermon_url } frameborder='0' allowFullScreen></iframe>`
70- } }
71- document . body . append ( obj . video . value ) ;
36+ const div2 = document . createElement ( "div" ) ;
37+ document . body . appendChild ( div2 ) ;
38+ //document.body.append('"' + res.verse.quote + '"');
39+ div2 . textContent = '"' + res . verse . quote + '"' ;
40+ div2 . style . marginBottom = "10px" ;
41+
42+ // Show "Watch a sermon" header
43+ const div3 = document . createElement ( 'div' )
44+ div3 . textContent = "Watch a sermon with Biblical teaching on " + taxonomy . toLowerCase ( ) + ":" ;
45+ div3 . style . marginTop = "10px"
46+ document . body . appendChild ( div3 )
47+
48+ // Show video recommendations
49+ const div4 = document . createElement ( 'div' ) ;
50+ div4 . style . marginTop = "10px" ;
51+
52+ // Video recommendation
53+ const video1 = document . createElement ( 'a' ) ;
54+ video1 . href = res . video . sermon_url ;
55+ video1 . title = res . video . sermon_speaker + " - " + res . video . sermon_title + " - " + res . video . sermon_location ;
56+ video1 . target = "_blank" ;
57+ const video_img1 = document . createElement ( 'img' ) ;
58+ video_img1 . src = "https://img.youtube.com/vi/" + res . video . sermon_url . slice ( 32 ) + "/0.jpg" ;
59+ video_img1 . width = 120 ;
60+ video_img1 . height = 90 ;
61+ video1 . appendChild ( video_img1 ) ;
62+ div4 . appendChild ( video1 ) ;
63+ document . body . appendChild ( div4 ) ;
64+
65+ // Show a dividing line
66+ const hr = document . createElement ( 'hr' ) ;
67+ hr . style . marginTop = "10px" ;
68+ document . body . appendChild ( hr ) ;
69+
70+ // Display the action icons
71+ const icon_like = document . createElement ( 'img' ) ;
72+ icon_like . src = "like.png" ;
73+ icon_like . width = 24 ;
74+ icon_like . height = 24 ;
75+
76+ const icon_share = document . createElement ( 'img' ) ;
77+ icon_share . src = "share.png" ;
78+ icon_share . width = 24 ;
79+ icon_share . height = 24 ;
80+
81+ const icon_settings = document . createElement ( 'img' ) ;
82+ icon_settings . src = "settings.png" ;
83+ icon_settings . width = 24 ;
84+ icon_settings . height = 24 ;
85+
86+ document . body . appendChild ( icon_like ) ;
87+ document . body . append ( ' ' ) ;
88+ document . body . appendChild ( icon_share ) ;
89+ document . body . append ( ' ' ) ;
90+ document . body . appendChild ( icon_settings ) ;
91+
7292
7393 }
7494
75- function onclick ( ) {
76-
77-
78- console . log ( chrome . tabs )
79-
95+ function onload ( ) {
8096 chrome . tabs . query ( { currentWindow : true , active : true } , function ( tabs ) {
81-
82-
83- chrome . tabs . sendMessage ( tabs [ 0 ] . id , "" , doThing ) ;
97+ chrome . tabs . sendMessage ( tabs [ 0 ] . id , "" , setCount ) ;
8498
8599
86100 } ) ;
0 commit comments