's
+ function save_music() {
+ var i, k, div, c, s, sa
+
+ // save MEI sequences
+ function save_spe(ty) {
+ var s, div
+ while (1) {
+ s = document.getElementsByTagName(ty)[0]
+ if (!s)
+ break
+ div = document.createElement('div')
+ abc2svg.music.push({
+ n: 'mus' + abc2svg.music.length,
+ t: s.outerHTML,
+ d: div
+ })
+ s.parentNode.replaceChild(div, s)
+ }
+ } // save_spe()
+
+ // get the global parameters
+ abc2svg.music = [{
+ t: "", // global parameters
+ n: "mus0"
+ }]
+
+ // get the parameters from the query string of the URL
+ k = location.search
+ if (k) {
+ k = k.substr(1).split("&")
+ for (i = 0; i < k.length; i++)
+ abc2svg.music[0].t += "%%"
+ + decodeURIComponent(k[i].replace('=', ' '))
+ + '\n'
+ }
+
+ // search the ', i)
- ss = j + 10
- break
- default: // < .. class="abc"
- j = i
-
- i = res[2].index(' ', i) // get the tag
- t = res[2].slice(1, i)
-
- i = page.indexOf('>', j)
- i = page.indexOf('\n', i) + 1
- new_page += page.slice(j, i) // keep the element
- j = page.indexOf('' + t + '>', i)
- ss = j + t.length + 4
- break
- }
- } else { // %abc or X:
-
- // get the end of the ABC sequence
- // including the %%beginxxx/%%endxxx sequences
- re_stop.lastIndex = i
- while (1) {
- res = re_stop.exec(page)
- if (!res || res[0] == "\n<")
- break
- k = page.indexOf(res[0].replace("begin", "end"),
- re_stop.lastIndex)
- if (k < 0)
- break
- re_stop.lastIndex = k
- }
- if (!res || k < 0)
- j = page.length
- else
- j = re_stop.lastIndex - 1
- ss = j
- }
- if (j < 0) {
-//fixme error
-console.log('error i/j '+i+' '+j)
- return
- }
-
- re.lastIndex = ss // new HTML start
-// src = page.slice(i, j) // music sequence
-// if (abc2svg.modules.load(src, render1))
-// render1()
-// } // extract()
-
- // render one text music sequence
- // @page is the content of the page
- // @ss and @se are the start and end indexes of the music sequence
- // i,j are the start and stop of the music inside the page source
-// function render1() {
- abc.tosvg(app, page, i, j)
- abc2svg.abc_end() // close the page if %%pageheight
-
- if (errtxt) {
- new_page += '
'
- + errtxt + "
\n"
- errtxt = ""
- }
-
- // try the next sequence
- extract()
- } // render1()
-
- // get the ABC insertion mode
- if (/