modifyHead.js 1.85 KB
/**
 * [个人中心]个人设置-编辑头像中flash相关操作
 * @author: jiangmin
 * @date: 2016/07/14
 */

/**
 * 设置flash样式,并返回html
 * @param id
 * @param width
 * @param height
 * @param url
 * @returns {string}
 */
function swfobject(id, width, height, url) {
    var _html = '<object id="' + id + '" width="' + width + '" height="' + height + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">' +
        '<param value="' + url + '" name="movie"> ' +
        '<param value="high" name="quality"> ' +
        '<param value="#E0E0E0" name="bgcolor"> ' +
        '<param name="allowFullScreen" value="true"> ' +
        '<param value="always" name="allowScriptAccess"> ' +
        '<param value="transparent" name="wmode"> ' +
        '<embed width="' + width + '" height="' + height + '" name="' + id + '" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" loop="false" play="true" bgcolor="#E0E0E0" quality="high" wmode="transparent" name="vMessage" src="' + url + '"> ' +
        '</object>';

    return _html;

}

function getFlashMovieObject(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf('Microsoft Internet') === -1) {
        if (document.embeds && document.embeds[movieName]) {
            return document.embeds[movieName];
        }
    } else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        return document.getElementById(movieName);
    }
}

/**
 * 上传图片,点击确定时调用
 */
function uploadImage() {
    var viFlash = getFlashMovieObject('head');

    viFlash.upload_image();
}


module.exports = {
    swfobject,
    uploadImage
};