Bookmarklet从iPad上的Safari中的actionlist调用onChange

时间:2012-09-26 00:59:27

标签: ipad safari onchange bookmarklet actionlist

我的工作使用专有系统来存储医疗记录。该网站使用javascript编码,我们无法更改网站的编码。我们希望使用iPad访问该网站,该网站通过提供HTML的浏览器进行访问。

有一个下拉列表,其中包含onChange值,当从下拉列表中选择onChange =“doAction(this)”时,会调用该值。这在桌面浏览器中工作正常,但iPad不支持onChange。我知道另一种方法是使用onBlue,但我们无权更改HTML。

我希望我们能做的是添加一个曾经点击过的书签,原则上就是onChange事件所做的。

当前的动作列表HTML是:

<select class="actionList" onChange="doAction(this)" style="width:100%"><option class="actionHeading" selected value="nothing">Select action ..</option><option class="action" value="moreInfo">&nbsp;&nbsp;More Info (shortcut key ' i ')</option><option class="actionHeading" disabled>Add Electronic Form ..</option><option class="action" value="xform-progressnotes-amendment-discharge">&nbsp;&nbsp;Amendment Discharge Summary</option><option class="action" value="xform-progressnotes-clinical-review">&nbsp;&nbsp;Clinical Review</option><option class="action" value="xform-dischargesummary">&nbsp;&nbsp;Discharge Summary</option><option class="action" value="xform-progressnotes-family-work">&nbsp;&nbsp;Family Work</option><option class="action" value="xform-progressnotes-medical-review">&nbsp;&nbsp;Medical Review</option><option class="action" value="xform-medicationsummary">&nbsp;&nbsp;Medication Summary Form</option><option class="action" value="xform-operationrecord">&nbsp;&nbsp;Operation Sheet</option><option class="action" value="xform-progressnotes-inpatient">&nbsp;&nbsp;Progress Notes</option><option class="action" value="xform-progressnotes-weekly-summary">&nbsp;&nbsp;Weekly Summary</option></select></td>

我想在书签中唯一的选择是“选择”医疗评论选项,即

<option class="action" value="xform-progressnotes-medical-review">&nbsp;&nbsp;Medical Review</option>

onChange =“doAction(this)”的javascript是:

function doAction(selectObj)
                {
                    var xformPrefix = 'xform-';
                    var chartPrefix = 'chart-';

                    var action = selectObj.value;
                    selectObj.selectedIndex = 0;
                    if (action == 'moreInfo')
                    {
                        moreInfo();
                    }
                    else if (action == 'referForAttn')
                    {
                        referForAttn();
                    }
                    else if(action.startsWith(chartPrefix)) {

                        var chartName = action.substring(chartPrefix.length);
                        var url;
                        var processedURL;

                        var checkExistUrl = '/udr/json/?action=chartsdescription';
                        checkExistUrl += '&patientId=630402';
                        checkExistUrl += '&chartName=' + chartName;
                        $.ajax({
                            async:false,
                            dataType:"json",
                            url:checkExistUrl,
                            success:function(data){

                                if(data.description != "")
                                {
                                    var answer = confirm(data.description);
                                }

                                if(answer || data.description == "")
                                {

                                }
                            }
                        });
                    }
                    else if (action.startsWith(xformPrefix))
                    {
                        var xformName = action.substring(xformPrefix.length);
                        var url;
                        var windowWidth;
                        var windowHeight;
                        var processedURL;


                            if (xformName == 'progressnotes-amendment-discharge')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-amendment-discharge&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-amendment-discharge%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }

                            if (xformName == 'progressnotes-clinical-review')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-clinical-review&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-clinical-review%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }

                            if (xformName == 'dischargesummary')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=dischargesummary&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Ddischargesummary%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 550;
                    }

                            if (xformName == 'progressnotes-family-work')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-family-work&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-family-work%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }

                            if (xformName == 'progressnotes-medical-review')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-medical-review&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-medical-review%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }

                            if (xformName == 'medicationsummary')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=medicationsummary&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dmedicationsummary%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 760;
                    }

                            if (xformName == 'operationrecord')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=operationrecord&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Doperationrecord%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 760;
                    }

                            if (xformName == 'progressnotes-inpatient')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-inpatient&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-inpatient%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }

                            if (xformName == 'progressnotes-weekly-summary')
                            {
                                url = '/oip-forms-viewer/forms/templates?udrSessionId=BF0C3C8399163439782C67D2757477DC&formName=progressnotes-weekly-summary&patientId=630402&episodeId=458698&transactionId=&xformAction=new&sectionId=Admission';

                                processedURL = '%2Foip-forms-viewer%2Fforms%2Ftemplates%3FudrSessionId%3DBF0C3C8399163439782C67D2757477DC%26formName%3Dprogressnotes-weekly-summary%26patientId%3D630402%26episodeId%3D458698%26transactionId%3D%26xformAction%3Dnew%26sectionId%3DAdmission'

                        windowWidth = 800;
                        windowHeight = 500;
                    }




                var newForm;
                var confirmMsg = "There is another e-form opened. \n";
                confirmMsg += "Press \"Cancel\" to finish editing the open e-form\n";
                confirmMsg += "Press \"OK\" to discard it and open a new one.";
                try {
                    var location = findFrame(top, 'main').win.document.location;
                    newForm = confirm(confirmMsg);
                }
                catch(e) {
                    newForm = true;
                }
                if(newForm) {
                    try {
                        findFrame(top, 'main').win.close();
                    }
                    catch(e) {}

                    findFrame(top, 'main').win = openCentredWindow(url, 'xformWindow', windowWidth, windowHeight);

                    try {
                        // setting the window title change on window load
                        $(findFrame(top, 'main').win).load(changeEformWindowTitle);
                    }
                    catch(e) {
                        // nothing to report
                    }
                    try {
                        // trying to change the window title early if the on load hasn't worked
                        setTimeout('changeEformWindowTitle()', 2000);
                    }
                    catch(e) {
                        // nothing to report
                    }
                    try {
                        // doing it a second time in case the first attempt was too early.
                        setTimeout('changeEformWindowTitle()', 8000);
                    }
                    catch(e) {
                        // nothing to report
                    }
                    try {
                        // doing it a third time 40 seconds later in case it there was a pre-fill.
                        setTimeout('changeEformWindowTitle()', 40000);
                    }
                    catch(e) {
                        // nothing to report
                    }
                }
                else {
                    findFrame(top, 'main').win.focus();
                }
            }
        }

非常感谢您提供的任何帮助! 感谢。

1 个答案:

答案 0 :(得分:0)

最好的办法是在ipad和实际产品之间放置代理服务器。 然后,此代理可以修改专有系统生成的html。

您可以将nginx视为代理的新手友好解决方案。

干杯, 吨。

PS:我不相信bookmarklet可以在iPad上运行。即使他们这样做,也会是一个糟糕的用户界面。